FindIce.cmake 23 KB

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