FindIce.cmake 24 KB

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