FindIce.cmake 23 KB

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