openmicroscopy/openmicroscopy — pull request #2920 by rleigh-dundee (2014-08-07 17:25:09+00:00)
Title: cmake: Add FindIce.cmake

Switch from extremely limited Ice autoconfiguration to a full cmake find_package implementation. This

- autodetects Ice on all major platforms
- allows building with all supported Visual Studio versions on Windows
- autodetects the slice path on most platforms
- does version checking to ensure the Ice version is correct
- separately detects the Ice programs, headers, slice files and
libraries so that any configuration or installation errors can
be accurately reported, making diagnosis of Ice problems much
simpler

On most platforms, it will now be possible to build without explicit configuration of any Ice settings such as `ICE_HOME` and `SLICEPATH`. Where configuration is required, it will be sufficient to set `ICE_HOME` or `ICE_SLICE_DIR` for most common cases, while also allowing finer-grained configuration if required.

If doing an out-of-tree cmake build, the autoconfigured Ice settings are also used when running the java build for source generation. In-tree builds however will still require Ice configuring up-front to allow the main build to work, though `build-cpp` can still take some advantage of FindIce.

------

Testing:

- jobs should remain green
- testable on all supported platforms; try running `cmake -DICE_DEBUG=ON /path/to/openmicroscopy` where `/path/to/openmicroscopy` is a clean source tree with this PR merged in. You should see it report correct autodetection of all Ice components. It should work if `ICE_HOME` is set or unset. On Windows it will autodetect the binary and library directories for the visual studio generator in use, picking the latest available Ice version (if installed in the default location) or can be overridden with `ICE_HOME`. (Windows build will compile but fail to link.)