FindIce.cmake 24 KB

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