1# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2# file Copyright.txt or https://cmake.org/licensing for details.
3
4#[=======================================================================[.rst:
5FindIce
6-------
7
8.. versionadded:: 3.1
9
10Find the ZeroC Internet Communication Engine (ICE) programs,
11libraries and datafiles.
12
13This module supports multiple components.
14Components can include any of: ``Freeze``, ``Glacier2``, ``Ice``,
15``IceBox``, ``IceDB``, ``IceDiscovery``, ``IceGrid``,
16``IceLocatorDiscovery``, ``IcePatch``, ``IceSSL``, ``IceStorm``,
17``IceUtil``, ``IceXML``, or ``Slice``.
18
19Ice 3.7 and later also include C++11-specific components:
20``Glacier2++11``, ``Ice++11``, ``IceBox++11``, ``IceDiscovery++11``
21``IceGrid``, ``IceLocatorDiscovery++11``, ``IceSSL++11``,
22``IceStorm++11``
23
24Note that the set of supported components is Ice version-specific.
25
26.. versionadded:: 3.4
27  Imported targets for components and most ``EXECUTABLE`` variables.
28
29.. versionadded:: 3.7
30  Debug and Release variants are found separately.
31
32.. versionadded:: 3.10
33  Ice 3.7 support, including new components, programs and the Nuget package.
34
35This module reports information about the Ice installation in
36several variables.  General variables::
37
38  Ice_VERSION - Ice release version
39  Ice_FOUND - true if the main programs and libraries were found
40  Ice_LIBRARIES - component libraries to be linked
41  Ice_INCLUDE_DIRS - the directories containing the Ice headers
42  Ice_SLICE_DIRS - the directories containing the Ice slice interface
43                   definitions
44
45Imported targets::
46
47  Ice::<C>
48
49Where ``<C>`` is the name of an Ice component, for example
50``Ice::Glacier2`` or ``Ice++11``.
51
52Ice slice programs are reported in::
53
54  Ice_SLICE2CONFLUENCE_EXECUTABLE - path to slice2confluence executable
55  Ice_SLICE2CPP_EXECUTABLE - path to slice2cpp executable
56  Ice_SLICE2CS_EXECUTABLE - path to slice2cs executable
57  Ice_SLICE2FREEZEJ_EXECUTABLE - path to slice2freezej executable
58  Ice_SLICE2FREEZE_EXECUTABLE - path to slice2freeze executable
59  Ice_SLICE2HTML_EXECUTABLE - path to slice2html executable
60  Ice_SLICE2JAVA_EXECUTABLE - path to slice2java executable
61  Ice_SLICE2JS_EXECUTABLE - path to slice2js executable
62  Ice_SLICE2MATLAB_EXECUTABLE - path to slice2matlab executable
63  Ice_SLICE2OBJC_EXECUTABLE - path to slice2objc executable
64  Ice_SLICE2PHP_EXECUTABLE - path to slice2php executable
65  Ice_SLICE2PY_EXECUTABLE - path to slice2py executable
66  Ice_SLICE2RB_EXECUTABLE - path to slice2rb executable
67
68.. versionadded:: 3.14
69  Variables for ``slice2confluence`` and ``slice2matlab``.
70
71Ice programs are reported in::
72
73  Ice_GLACIER2ROUTER_EXECUTABLE - path to glacier2router executable
74  Ice_ICEBOX_EXECUTABLE - path to icebox executable
75  Ice_ICEBOXXX11_EXECUTABLE - path to icebox++11 executable
76  Ice_ICEBOXADMIN_EXECUTABLE - path to iceboxadmin executable
77  Ice_ICEBOXD_EXECUTABLE - path to iceboxd executable
78  Ice_ICEBOXNET_EXECUTABLE - path to iceboxnet executable
79  Ice_ICEBRIDGE_EXECUTABLE - path to icebridge executable
80  Ice_ICEGRIDADMIN_EXECUTABLE - path to icegridadmin executable
81  Ice_ICEGRIDDB_EXECUTABLE - path to icegriddb executable
82  Ice_ICEGRIDNODE_EXECUTABLE - path to icegridnode executable
83  Ice_ICEGRIDNODED_EXECUTABLE - path to icegridnoded executable
84  Ice_ICEGRIDREGISTRY_EXECUTABLE - path to icegridregistry executable
85  Ice_ICEGRIDREGISTRYD_EXECUTABLE - path to icegridregistryd executable
86  Ice_ICEPATCH2CALC_EXECUTABLE - path to icepatch2calc executable
87  Ice_ICEPATCH2CLIENT_EXECUTABLE - path to icepatch2client executable
88  Ice_ICEPATCH2SERVER_EXECUTABLE - path to icepatch2server executable
89  Ice_ICESERVICEINSTALL_EXECUTABLE - path to iceserviceinstall executable
90  Ice_ICESTORMADMIN_EXECUTABLE - path to icestormadmin executable
91  Ice_ICESTORMDB_EXECUTABLE - path to icestormdb executable
92  Ice_ICESTORMMIGRATE_EXECUTABLE - path to icestormmigrate executable
93
94Ice db programs (Windows only; standard system versions on all other
95platforms) are reported in::
96
97  Ice_DB_ARCHIVE_EXECUTABLE - path to db_archive executable
98  Ice_DB_CHECKPOINT_EXECUTABLE - path to db_checkpoint executable
99  Ice_DB_DEADLOCK_EXECUTABLE - path to db_deadlock executable
100  Ice_DB_DUMP_EXECUTABLE - path to db_dump executable
101  Ice_DB_HOTBACKUP_EXECUTABLE - path to db_hotbackup executable
102  Ice_DB_LOAD_EXECUTABLE - path to db_load executable
103  Ice_DB_LOG_VERIFY_EXECUTABLE - path to db_log_verify executable
104  Ice_DB_PRINTLOG_EXECUTABLE - path to db_printlog executable
105  Ice_DB_RECOVER_EXECUTABLE - path to db_recover executable
106  Ice_DB_STAT_EXECUTABLE - path to db_stat executable
107  Ice_DB_TUNER_EXECUTABLE - path to db_tuner executable
108  Ice_DB_UPGRADE_EXECUTABLE - path to db_upgrade executable
109  Ice_DB_VERIFY_EXECUTABLE - path to db_verify executable
110  Ice_DUMPDB_EXECUTABLE - path to dumpdb executable
111  Ice_TRANSFORMDB_EXECUTABLE - path to transformdb executable
112
113Ice component libraries are reported in::
114
115  Ice_<C>_FOUND - ON if component was found
116  Ice_<C>_LIBRARIES - libraries for component
117
118Note that ``<C>`` is the uppercased name of the component.
119
120This module reads hints about search results from::
121
122  Ice_HOME - the root of the Ice installation
123
124The environment variable ``ICE_HOME`` may also be used; the
125Ice_HOME variable takes precedence.
126
127.. note::
128  On Windows, Ice 3.7.0 and later provide libraries via the NuGet
129  package manager.  Appropriate NuGet packages will be searched for
130  using ``CMAKE_PREFIX_PATH``, or alternatively ``Ice_HOME`` may be
131  set to the location of a specific NuGet package to restrict the
132  search.
133
134The following cache variables may also be set::
135
136  Ice_<P>_EXECUTABLE - the path to executable <P>
137  Ice_INCLUDE_DIR - the directory containing the Ice headers
138  Ice_SLICE_DIR - the directory containing the Ice slice interface
139                  definitions
140  Ice_<C>_LIBRARY - the library for component <C>
141
142.. note::
143
144  In most cases none of the above variables will require setting,
145  unless multiple Ice versions are available and a specific version
146  is required.  On Windows, the most recent version of Ice will be
147  found through the registry.  On Unix, the programs, headers and
148  libraries will usually be in standard locations, but Ice_SLICE_DIRS
149  might not be automatically detected (commonly known locations are
150  searched).  All the other variables are defaulted using Ice_HOME,
151  if set.  It's possible to set Ice_HOME and selectively specify
152  alternative locations for the other components; this might be
153  required for e.g. newer versions of Visual Studio if the
154  heuristics are not sufficient to identify the correct programs and
155  libraries for the specific Visual Studio version.
156
157Other variables one may set to control this module are::
158
159  Ice_DEBUG - Set to ON to enable debug output from FindIce.
160#]=======================================================================]
161
162# Written by Roger Leigh <[email protected]>
163
164  set(_Ice_db_programs
165      db_archive
166      db_checkpoint
167      db_deadlock
168      db_dump
169      db_hotbackup
170      db_load
171      db_log_verify
172      db_printlog
173      db_recover
174      db_stat
175      db_tuner
176      db_upgrade
177      db_verify
178      dumpdb
179      transformdb)
180
181  set(_Ice_programs
182      glacier2router
183      icebox
184      icebox++11
185      iceboxadmin
186      iceboxd
187      iceboxnet
188      icebridge
189      icegridadmin
190      icegriddb
191      icegridnode
192      icegridnoded
193      icegridregistry
194      icegridregistryd
195      icepatch2calc
196      icepatch2client
197      icepatch2server
198      iceserviceinstall
199      icestormadmin
200      icestormdb
201      icestormmigrate)
202
203  set(_Ice_slice_programs
204      slice2confluence
205      slice2cpp
206      slice2cs
207      slice2freezej
208      slice2freeze
209      slice2html
210      slice2java
211      slice2js
212      slice2matlab
213      slice2objc
214      slice2php
215      slice2py
216      slice2rb)
217
218
219# The Ice checks are contained in a function due to the large number
220# of temporary variables needed.
221function(_Ice_FIND)
222  # Released versions of Ice, including generic short forms
223  set(ice_versions
224      3
225      3.7
226      3.7.0
227      3.6
228      3.6.3
229      3.6.2
230      3.6.1
231      3.6.0
232      3.5
233      3.5.1
234      3.5.0
235      3.4
236      3.4.2
237      3.4.1
238      3.4.0
239      3.3
240      3.3.1
241      3.3.0)
242
243  foreach(ver ${ice_versions})
244    string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\$" two_digit_version_match "${ver}")
245    if(two_digit_version_match)
246      string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\$" "\\1\\2" two_digit_version "${ver}")
247      list(APPEND ice_suffix_versions "${two_digit_version}")
248    endif()
249  endforeach()
250
251  # Set up search paths, taking compiler into account.  Search Ice_HOME,
252  # with ICE_HOME in the environment as a fallback if unset.
253  if(Ice_HOME)
254    list(APPEND ice_roots "${Ice_HOME}")
255  else()
256    if(NOT "$ENV{ICE_HOME}" STREQUAL "")
257      file(TO_CMAKE_PATH "$ENV{ICE_HOME}" NATIVE_PATH)
258      list(APPEND ice_roots "${NATIVE_PATH}")
259      set(Ice_HOME "${NATIVE_PATH}"
260          CACHE PATH "Location of the Ice installation" FORCE)
261    endif()
262  endif()
263
264  set(_bin "bin/Win32")
265  set(_lib "lib/Win32")
266  if(CMAKE_SIZEOF_VOID_P EQUAL 8)
267    set(_bin "bin/x64")
268    set(_lib "lib/x64")
269    # 64-bit path suffix
270    set(_x64 "/x64")
271    # 64-bit library directory
272    set(_lib64 "lib64")
273  endif()
274
275  unset(vcvers)
276  if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
277    if(MSVC_TOOLSET_VERSION GREATER_EQUAL 141)
278      set(vcvers "141;140")
279    elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 100)
280      set(vcvers "${MSVC_TOOLSET_VERSION}")
281    elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 90)
282      set(vcvers "${MSVC_TOOLSET_VERSION}")
283      set(vcyear "2008")
284    elseif(MSVC_TOOLSET_VERSION GREATER_EQUAL 80)
285      set(vcvers "${MSVC_TOOLSET_VERSION}")
286      set(vcyear "2005")
287    else() # Unknown version
288      set(vcvers Unknown)
289    endif()
290  endif()
291
292  # For compatibility with ZeroC Windows builds.
293  if(vcvers)
294    list(APPEND ice_binary_suffixes "build/native/${_bin}/Release" "tools")
295    list(APPEND ice_debug_library_suffixes "build/native/${_lib}/Debug")
296    list(APPEND ice_release_library_suffixes "build/native/${_lib}/Release")
297    foreach(vcver IN LISTS vcvers)
298      # Earlier Ice (3.3) builds don't use vcnnn subdirectories, but are harmless to check.
299      list(APPEND ice_binary_suffixes "bin/vc${vcver}${_x64}" "bin/vc${vcver}")
300      list(APPEND ice_debug_library_suffixes "lib/vc${vcver}${_x64}" "lib/vc${vcver}")
301      list(APPEND ice_release_library_suffixes "lib/vc${vcver}${_x64}" "lib/vc${vcver}")
302    endforeach()
303  endif()
304  # Generic 64-bit and 32-bit directories
305  list(APPEND ice_binary_suffixes "bin${_x64}" "bin")
306  list(APPEND ice_debug_library_suffixes "libx32" "${_lib64}" "lib${_x64}" "lib")
307  list(APPEND ice_release_library_suffixes "libx32" "${_lib64}" "lib${_x64}" "lib")
308  if(vcvers)
309    list(APPEND ice_include_suffixes "build/native/include")
310  endif()
311  list(APPEND ice_include_suffixes "include")
312  list(APPEND ice_slice_suffixes "slice")
313
314  # On Windows, look in the registry for install locations.  Different
315  # versions of Ice install support different compiler versions.
316  if(vcvers)
317    foreach(ice_version ${ice_versions})
318      foreach(vcver IN LISTS vcvers)
319        list(APPEND ice_nuget_dirs "zeroc.ice.v${vcver}.${ice_version}")
320        list(APPEND freeze_nuget_dirs "zeroc.freeze.v${vcver}.${ice_version}")
321      endforeach()
322    endforeach()
323    find_path(Ice_NUGET_DIR
324              NAMES "tools/slice2cpp.exe"
325              PATH_SUFFIXES ${ice_nuget_dirs}
326              DOC "Ice NuGet directory")
327    if(Ice_NUGET_DIR)
328      list(APPEND ice_roots "${Ice_NUGET_DIR}")
329    endif()
330    find_path(Freeze_NUGET_DIR
331              NAMES "tools/slice2freeze.exe"
332              PATH_SUFFIXES ${freeze_nuget_dirs}
333              DOC "Freeze NuGet directory")
334    if(Freeze_NUGET_DIR)
335      list(APPEND ice_roots "${Freeze_NUGET_DIR}")
336    endif()
337    foreach(ice_version ${ice_versions})
338      # Ice 3.3 releases use a Visual Studio year suffix and value is
339      # enclosed in double quotes, though only the leading quote is
340      # returned by get_filename_component.
341      unset(ice_location)
342      if(vcyear)
343        get_filename_component(ice_location
344                               "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ZeroC\\Ice ${ice_version} for Visual Studio ${vcyear};InstallDir]"
345                               PATH)
346        if(ice_location AND NOT ("${ice_location}" STREQUAL "/registry" OR "${ice_location}" STREQUAL "/"))
347          string(REGEX REPLACE "^\"(.*)\"?$" "\\1" ice_location "${ice_location}")
348          get_filename_component(ice_location "${ice_location}" ABSOLUTE)
349        else()
350          unset(ice_location)
351        endif()
352      endif()
353      # Ice 3.4+ releases don't use a suffix
354      if(NOT ice_location OR "${ice_location}" STREQUAL "/registry")
355        get_filename_component(ice_location
356                               "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ZeroC\\Ice ${ice_version};InstallDir]"
357                               ABSOLUTE)
358      endif()
359
360      if(ice_location AND NOT "${ice_location}" STREQUAL "/registry")
361        list(APPEND ice_roots "${ice_location}")
362      endif()
363    endforeach()
364  else()
365    foreach(ice_version ${ice_versions})
366      # Prefer 64-bit variants if present (and using a 64-bit compiler)
367      list(APPEND ice_roots "/opt/Ice-${ice_version}")
368    endforeach()
369  endif()
370
371  # Find all Ice programs
372  foreach(program ${_Ice_db_programs} ${_Ice_programs} ${_Ice_slice_programs})
373    string(TOUPPER "${program}" program_upcase)
374    set(cache_var "Ice_${program_upcase}_EXECUTABLE")
375    set(program_var "Ice_${program_upcase}_EXECUTABLE")
376    find_program("${cache_var}" "${program}"
377      HINTS ${ice_roots}
378      PATH_SUFFIXES ${ice_binary_suffixes}
379      DOC "Ice ${program} executable")
380    mark_as_advanced(cache_var)
381    set("${program_var}" "${${cache_var}}" PARENT_SCOPE)
382  endforeach()
383
384  # Get version.
385  if(Ice_SLICE2CPP_EXECUTABLE)
386    # Execute in C locale for safety
387    set(_Ice_SAVED_LC_ALL "$ENV{LC_ALL}")
388    set(ENV{LC_ALL} C)
389
390    execute_process(COMMAND ${Ice_SLICE2CPP_EXECUTABLE} --version
391      ERROR_VARIABLE Ice_VERSION_SLICE2CPP_FULL
392      ERROR_STRIP_TRAILING_WHITESPACE)
393
394    # restore the previous LC_ALL
395    set(ENV{LC_ALL} ${_Ice_SAVED_LC_ALL})
396
397    # Make short version
398    string(REGEX REPLACE "^(.*)\\.[^.]*$" "\\1" Ice_VERSION_SLICE2CPP_SHORT "${Ice_VERSION_SLICE2CPP_FULL}")
399    set(Ice_VERSION "${Ice_VERSION_SLICE2CPP_FULL}" PARENT_SCOPE)
400  endif()
401
402  if(NOT Ice_FIND_QUIETLY)
403    message(STATUS "Ice version: ${Ice_VERSION_SLICE2CPP_FULL}")
404  endif()
405
406  # Find include directory
407  find_path(Ice_INCLUDE_DIR
408            NAMES "Ice/Ice.h"
409            HINTS ${ice_roots}
410            PATH_SUFFIXES ${ice_include_suffixes}
411            DOC "Ice include directory")
412  set(Ice_INCLUDE_DIR "${Ice_INCLUDE_DIR}" PARENT_SCOPE)
413
414  find_path(Freeze_INCLUDE_DIR
415            NAMES "Freeze/Freeze.h"
416            HINTS ${ice_roots}
417            PATH_SUFFIXES ${ice_include_suffixes}
418            DOC "Freeze include directory")
419  set(Freeze_INCLUDE_DIR "${Freeze_INCLUDE_DIR}" PARENT_SCOPE)
420
421  # In common use on Linux, MacOS X (homebrew) and FreeBSD; prefer
422  # version-specific dir
423  list(APPEND ice_slice_paths
424       /usr/local/share /usr/share)
425  list(APPEND ice_slice_suffixes
426       "Ice-${Ice_VERSION_SLICE2CPP_FULL}/slice"
427       "Ice-${Ice_VERSION_SLICE2CPP_SHORT}/slice"
428       "ice/slice"
429       Ice)
430
431  # Find slice directory
432  find_path(Ice_SLICE_DIR
433            NAMES "Ice/Connection.ice"
434            HINTS ${ice_roots}
435                  ${ice_slice_paths}
436            PATH_SUFFIXES ${ice_slice_suffixes}
437            NO_DEFAULT_PATH
438            DOC "Ice slice directory")
439  set(Ice_SLICE_DIR "${Ice_SLICE_DIR}" PARENT_SCOPE)
440
441  # Find all Ice libraries
442  set(Ice_REQUIRED_LIBS_FOUND ON)
443  foreach(component ${Ice_FIND_COMPONENTS})
444    string(TOUPPER "${component}" component_upcase)
445    set(component_cache "Ice_${component_upcase}_LIBRARY")
446    set(component_cache_release "${component_cache}_RELEASE")
447    set(component_cache_debug "${component_cache}_DEBUG")
448    set(component_found "${component_upcase}_FOUND")
449    set(component_library "${component}")
450    unset(component_library_release_names)
451    unset(component_library_debug_names)
452    if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
453      string(REGEX MATCH ".+\\+\\+11$" component_library_cpp11 "${component_library}")
454      if(component_library_cpp11)
455        string(REGEX REPLACE "^(.+)(\\+\\+11)$" "\\1" component_library "${component_library}")
456      endif()
457      foreach(suffix_ver ${ice_suffix_versions})
458        set(_name "${component_library}${suffix_ver}")
459        if(component_library_cpp11)
460          string(APPEND _name "++11")
461        endif()
462        list(APPEND component_library_debug_names "${_name}d")
463        list(APPEND component_library_release_names "${_name}")
464      endforeach()
465      set(_name "${component_library}")
466      if(component_library_cpp11)
467        string(APPEND _name "++11")
468      endif()
469      list(APPEND component_library_debug_names "${_name}d")
470      list(APPEND component_library_release_names "${_name}")
471    else()
472      list(APPEND component_library_debug_names "${component_library}d")
473      list(APPEND component_library_release_names "${component_library}")
474    endif()
475    find_library("${component_cache_release}" ${component_library_release_names}
476      HINTS ${ice_roots}
477      PATH_SUFFIXES ${ice_release_library_suffixes}
478      DOC "Ice ${component} library (release)")
479    find_library("${component_cache_debug}" ${component_library_debug_names}
480      HINTS ${ice_roots}
481      PATH_SUFFIXES ${ice_debug_library_suffixes}
482      DOC "Ice ${component} library (debug)")
483    include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
484    select_library_configurations(Ice_${component_upcase})
485    mark_as_advanced("${component_cache_release}" "${component_cache_debug}")
486    if(${component_cache})
487      set("${component_found}" ON)
488      list(APPEND Ice_LIBRARY "${${component_cache}}")
489    endif()
490    mark_as_advanced("${component_found}")
491    set("${component_cache}" "${${component_cache}}" PARENT_SCOPE)
492    set("${component_found}" "${${component_found}}" PARENT_SCOPE)
493    if(${component_found})
494      if (Ice_FIND_REQUIRED_${component})
495        list(APPEND Ice_LIBS_FOUND "${component} (required)")
496      else()
497        list(APPEND Ice_LIBS_FOUND "${component} (optional)")
498      endif()
499    else()
500      if (Ice_FIND_REQUIRED_${component})
501        set(Ice_REQUIRED_LIBS_FOUND OFF)
502        list(APPEND Ice_LIBS_NOTFOUND "${component} (required)")
503      else()
504        list(APPEND Ice_LIBS_NOTFOUND "${component} (optional)")
505      endif()
506    endif()
507  endforeach()
508  set(_Ice_REQUIRED_LIBS_FOUND "${Ice_REQUIRED_LIBS_FOUND}" PARENT_SCOPE)
509  set(Ice_LIBRARY "${Ice_LIBRARY}" PARENT_SCOPE)
510
511  if(NOT Ice_FIND_QUIETLY)
512    if(Ice_LIBS_FOUND)
513      message(STATUS "Found the following Ice libraries:")
514      foreach(found ${Ice_LIBS_FOUND})
515        message(STATUS "  ${found}")
516      endforeach()
517    endif()
518    if(Ice_LIBS_NOTFOUND)
519      message(STATUS "The following Ice libraries were not found:")
520      foreach(notfound ${Ice_LIBS_NOTFOUND})
521        message(STATUS "  ${notfound}")
522      endforeach()
523    endif()
524  endif()
525
526  if(Ice_DEBUG)
527    message(STATUS "--------FindIce.cmake search debug--------")
528    message(STATUS "ICE binary path search order: ${ice_roots}")
529    message(STATUS "ICE binary suffixes: ${ice_binary_suffixes}")
530    message(STATUS "ICE include path search order: ${ice_roots}")
531    message(STATUS "ICE include suffixes: ${ice_include_suffixes}")
532    message(STATUS "ICE slice path search order: ${ice_roots} ${ice_slice_paths}")
533    message(STATUS "ICE slice suffixes: ${ice_slice_suffixes}")
534    message(STATUS "ICE library path search order: ${ice_roots}")
535    message(STATUS "ICE debug library suffixes: ${ice_debug_library_suffixes}")
536    message(STATUS "ICE release library suffixes: ${ice_release_library_suffixes}")
537    message(STATUS "----------------")
538  endif()
539endfunction()
540
541_Ice_FIND()
542
543include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
544FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ice
545                                  FOUND_VAR Ice_FOUND
546                                  REQUIRED_VARS Ice_SLICE2CPP_EXECUTABLE
547                                                Ice_INCLUDE_DIR
548                                                Ice_SLICE_DIR
549                                                Ice_LIBRARY
550                                                _Ice_REQUIRED_LIBS_FOUND
551                                  VERSION_VAR Ice_VERSION
552                                  FAIL_MESSAGE "Failed to find all Ice components")
553
554unset(_Ice_REQUIRED_LIBS_FOUND)
555
556if(Ice_FOUND)
557  set(Ice_INCLUDE_DIRS "${Ice_INCLUDE_DIR}")
558  if (Freeze_INCLUDE_DIR)
559    list(APPEND Ice_INCLUDE_DIRS "${Freeze_INCLUDE_DIR}")
560  endif()
561  set(Ice_SLICE_DIRS "${Ice_SLICE_DIR}")
562  set(Ice_LIBRARIES "${Ice_LIBRARY}")
563  foreach(_Ice_component ${Ice_FIND_COMPONENTS})
564    string(TOUPPER "${_Ice_component}" _Ice_component_upcase)
565    set(_Ice_component_cache "Ice_${_Ice_component_upcase}_LIBRARY")
566    set(_Ice_component_cache_release "Ice_${_Ice_component_upcase}_LIBRARY_RELEASE")
567    set(_Ice_component_cache_debug "Ice_${_Ice_component_upcase}_LIBRARY_DEBUG")
568    set(_Ice_component_lib "Ice_${_Ice_component_upcase}_LIBRARIES")
569    set(_Ice_component_found "${_Ice_component_upcase}_FOUND")
570    set(_Ice_imported_target "Ice::${_Ice_component}")
571    if(${_Ice_component_found})
572      set("${_Ice_component_lib}" "${${_Ice_component_cache}}")
573      if(NOT TARGET ${_Ice_imported_target})
574        add_library(${_Ice_imported_target} UNKNOWN IMPORTED)
575        set_target_properties(${_Ice_imported_target} PROPERTIES
576          INTERFACE_INCLUDE_DIRECTORIES "${Ice_INCLUDE_DIRS}")
577        if(EXISTS "${${_Ice_component_cache}}")
578          set_target_properties(${_Ice_imported_target} PROPERTIES
579            IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
580            IMPORTED_LOCATION "${${_Ice_component_cache}}")
581        endif()
582        if(EXISTS "${${_Ice_component_cache_release}}")
583          set_property(TARGET ${_Ice_imported_target} APPEND PROPERTY
584            IMPORTED_CONFIGURATIONS RELEASE)
585          set_target_properties(${_Ice_imported_target} PROPERTIES
586            IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
587            IMPORTED_LOCATION_RELEASE "${${_Ice_component_cache_release}}")
588        endif()
589        if(EXISTS "${${_Ice_component_cache_debug}}")
590          set_property(TARGET ${_Ice_imported_target} APPEND PROPERTY
591            IMPORTED_CONFIGURATIONS DEBUG)
592          set_target_properties(${_Ice_imported_target} PROPERTIES
593            IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
594            IMPORTED_LOCATION_DEBUG "${${_Ice_component_cache_debug}}")
595        endif()
596      endif()
597    endif()
598    unset(_Ice_component_upcase)
599    unset(_Ice_component_cache)
600    unset(_Ice_component_lib)
601    unset(_Ice_component_found)
602    unset(_Ice_imported_target)
603  endforeach()
604endif()
605
606if(Ice_DEBUG)
607  message(STATUS "--------FindIce.cmake results debug--------")
608  message(STATUS "Ice_VERSION number: ${Ice_VERSION}")
609  message(STATUS "Ice_HOME directory: ${Ice_HOME}")
610  message(STATUS "Ice_INCLUDE_DIR directory: ${Ice_INCLUDE_DIR}")
611  message(STATUS "Ice_SLICE_DIR directory: ${Ice_SLICE_DIR}")
612  message(STATUS "Ice_LIBRARIES: ${Ice_LIBRARIES}")
613  message(STATUS "Freeze_INCLUDE_DIR directory: ${Freeze_INCLUDE_DIR}")
614  message(STATUS "Ice_INCLUDE_DIRS directory: ${Ice_INCLUDE_DIRS}")
615
616  foreach(program ${_Ice_db_programs} ${_Ice_programs} ${_Ice_slice_programs})
617    string(TOUPPER "${program}" program_upcase)
618    message(STATUS "${program} executable: ${Ice_${program_upcase}_EXECUTABLE}")
619  endforeach()
620
621  foreach(component ${Ice_FIND_COMPONENTS})
622    string(TOUPPER "${component}" component_upcase)
623    set(component_lib "Ice_${component_upcase}_LIBRARIES")
624    set(component_found "${component_upcase}_FOUND")
625    message(STATUS "${component} library found: ${${component_found}}")
626    message(STATUS "${component} library: ${${component_lib}}")
627  endforeach()
628  message(STATUS "----------------")
629endif()
630
631unset(_Ice_db_programs)
632unset(_Ice_programs)
633unset(_Ice_slice_programs)
634