FindHDF5.cmake 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864
  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. # FindHDF5
  5. # --------
  6. #
  7. # Find HDF5, a library for reading and writing self describing array data.
  8. #
  9. #
  10. #
  11. # This module invokes the HDF5 wrapper compiler that should be installed
  12. # alongside HDF5. Depending upon the HDF5 Configuration, the wrapper
  13. # compiler is called either h5cc or h5pcc. If this succeeds, the module
  14. # will then call the compiler with the -show argument to see what flags
  15. # are used when compiling an HDF5 client application.
  16. #
  17. # The module will optionally accept the COMPONENTS argument. If no
  18. # COMPONENTS are specified, then the find module will default to finding
  19. # only the HDF5 C library. If one or more COMPONENTS are specified, the
  20. # module will attempt to find the language bindings for the specified
  21. # components. The only valid components are C, CXX, Fortran, HL, and
  22. # Fortran_HL. If the COMPONENTS argument is not given, the module will
  23. # attempt to find only the C bindings.
  24. #
  25. # On UNIX systems, this module will read the variable
  26. # HDF5_USE_STATIC_LIBRARIES to determine whether or not to prefer a
  27. # static link to a dynamic link for HDF5 and all of it's dependencies.
  28. # To use this feature, make sure that the HDF5_USE_STATIC_LIBRARIES
  29. # variable is set before the call to find_package.
  30. #
  31. # To provide the module with a hint about where to find your HDF5
  32. # installation, you can set the environment variable HDF5_ROOT. The
  33. # Find module will then look in this path when searching for HDF5
  34. # executables, paths, and libraries.
  35. #
  36. # Both the serial and parallel HDF5 wrappers are considered and the first
  37. # directory to contain either one will be used. In the event that both appear
  38. # in the same directory the serial version is preferentially selected. This
  39. # behavior can be reversed by setting the variable HDF5_PREFER_PARALLEL to
  40. # true.
  41. #
  42. # In addition to finding the includes and libraries required to compile
  43. # an HDF5 client application, this module also makes an effort to find
  44. # tools that come with the HDF5 distribution that may be useful for
  45. # regression testing.
  46. #
  47. # This module will define the following variables:
  48. #
  49. # ::
  50. #
  51. # HDF5_FOUND - true if HDF5 was found on the system
  52. # HDF5_VERSION - HDF5 version in format Major.Minor.Release
  53. # HDF5_INCLUDE_DIRS - Location of the hdf5 includes
  54. # HDF5_INCLUDE_DIR - Location of the hdf5 includes (deprecated)
  55. # HDF5_DEFINITIONS - Required compiler definitions for HDF5
  56. # HDF5_LIBRARIES - Required libraries for all requested bindings
  57. # HDF5_HL_LIBRARIES - Required libraries for the HDF5 high level API for all
  58. # bindings, if the HL component is enabled
  59. #
  60. # Available components are: C CXX Fortran and HL. For each enabled language
  61. # binding, a corresponding HDF5_${LANG}_LIBRARIES variable, and potentially
  62. # HDF5_${LANG}_DEFINITIONS, will be defined.
  63. # If the HL component is enabled, then an HDF5_${LANG}_HL_LIBRARIES will
  64. # also be defined. With all components enabled, the following variables will be defined:
  65. #
  66. # ::
  67. #
  68. # HDF5_C_DEFINITIONS -- Required compiler definitions for HDF5 C bindings
  69. # HDF5_CXX_DEFINITIONS -- Required compiler definitions for HDF5 C++ bindings
  70. # HDF5_Fortran_DEFINITIONS -- Required compiler definitions for HDF5 Fortran bindings
  71. # HDF5_C_INCLUDE_DIRS -- Required include directories for HDF5 C bindings
  72. # HDF5_CXX_INCLUDE_DIRS -- Required include directories for HDF5 C++ bindings
  73. # HDF5_Fortran_INCLUDE_DIRS -- Required include directories for HDF5 Fortran bindings
  74. # HDF5_C_LIBRARIES - Required libraries for the HDF5 C bindings
  75. # HDF5_CXX_LIBRARIES - Required libraries for the HDF5 C++ bindings
  76. # HDF5_Fortran_LIBRARIES - Required libraries for the HDF5 Fortran bindings
  77. # HDF5_C_HL_LIBRARIES - Required libraries for the high level C bindings
  78. # HDF5_CXX_HL_LIBRARIES - Required libraries for the high level C++ bindings
  79. # HDF5_Fortran_HL_LIBRARIES - Required libraries for the high level Fortran
  80. # bindings.
  81. #
  82. # HDF5_IS_PARALLEL - Whether or not HDF5 was found with parallel IO support
  83. # HDF5_C_COMPILER_EXECUTABLE - the path to the HDF5 C wrapper compiler
  84. # HDF5_CXX_COMPILER_EXECUTABLE - the path to the HDF5 C++ wrapper compiler
  85. # HDF5_Fortran_COMPILER_EXECUTABLE - the path to the HDF5 Fortran wrapper compiler
  86. # HDF5_C_COMPILER_EXECUTABLE_NO_INTERROGATE - path to the primary C compiler
  87. # which is also the HDF5 wrapper
  88. # HDF5_CXX_COMPILER_EXECUTABLE_NO_INTERROGATE - path to the primary C++
  89. # compiler which is also
  90. # the HDF5 wrapper
  91. # HDF5_Fortran_COMPILER_EXECUTABLE_NO_INTERROGATE - path to the primary
  92. # Fortran compiler which
  93. # is also the HDF5 wrapper
  94. # HDF5_DIFF_EXECUTABLE - the path to the HDF5 dataset comparison tool
  95. #
  96. # The following variable can be set to guide the search for HDF5 libraries and includes:
  97. #
  98. # HDF5_ROOT
  99. #
  100. # Set HDF5_FIND_DEBUG to true to get some extra debugging output.
  101. # This module is maintained by Will Dicharry <[email protected]>.
  102. include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
  103. include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
  104. # List of the valid HDF5 components
  105. set(HDF5_VALID_LANGUAGE_BINDINGS C CXX Fortran)
  106. # Validate the list of find components.
  107. if(NOT HDF5_FIND_COMPONENTS)
  108. set(HDF5_LANGUAGE_BINDINGS "C")
  109. else()
  110. set(HDF5_LANGUAGE_BINDINGS)
  111. # add the extra specified components, ensuring that they are valid.
  112. set(FIND_HL OFF)
  113. foreach(component IN LISTS HDF5_FIND_COMPONENTS)
  114. list(FIND HDF5_VALID_LANGUAGE_BINDINGS ${component} component_location)
  115. if(NOT component_location EQUAL -1)
  116. list(APPEND HDF5_LANGUAGE_BINDINGS ${component})
  117. elseif(component STREQUAL "HL")
  118. set(FIND_HL ON)
  119. elseif(component STREQUAL "Fortran_HL") # only for compatibility
  120. list(APPEND HDF5_LANGUAGE_BINDINGS Fortran)
  121. set(FIND_HL ON)
  122. set(HDF5_FIND_REQUIRED_Fortran_HL False)
  123. set(HDF5_FIND_REQUIRED_Fortran True)
  124. set(HDF5_FIND_REQUIRED_HL True)
  125. else()
  126. message(FATAL_ERROR "${component} is not a valid HDF5 component.")
  127. endif()
  128. endforeach()
  129. if(NOT HDF5_LANGUAGE_BINDINGS)
  130. get_property(__langs GLOBAL PROPERTY ENABLED_LANGUAGES)
  131. foreach(__lang IN LISTS __langs)
  132. if(__lang MATCHES "^(C|CXX|Fortran)$")
  133. list(APPEND HDF5_LANGUAGE_BINDINGS ${__lang})
  134. endif()
  135. endforeach()
  136. endif()
  137. list(REMOVE_ITEM HDF5_FIND_COMPONENTS Fortran_HL) # replaced by Fortran and HL
  138. list(REMOVE_DUPLICATES HDF5_LANGUAGE_BINDINGS)
  139. endif()
  140. # Determine whether to search for serial or parallel executable first
  141. if(HDF5_PREFER_PARALLEL)
  142. set(HDF5_C_COMPILER_NAMES h5pcc h5cc)
  143. set(HDF5_CXX_COMPILER_NAMES h5pc++ h5c++)
  144. set(HDF5_Fortran_COMPILER_NAMES h5pfc h5fc)
  145. else()
  146. set(HDF5_C_COMPILER_NAMES h5cc h5pcc)
  147. set(HDF5_CXX_COMPILER_NAMES h5c++ h5pc++)
  148. set(HDF5_Fortran_COMPILER_NAMES h5fc h5pfc)
  149. endif()
  150. # We may have picked up some duplicates in various lists during the above
  151. # process for the language bindings (both the C and C++ bindings depend on
  152. # libz for example). Remove the duplicates. It appears that the default
  153. # CMake behavior is to remove duplicates from the end of a list. However,
  154. # for link lines, this is incorrect since unresolved symbols are searched
  155. # for down the link line. Therefore, we reverse the list, remove the
  156. # duplicates, and then reverse it again to get the duplicates removed from
  157. # the beginning.
  158. macro(_HDF5_remove_duplicates_from_beginning _list_name)
  159. if(${_list_name})
  160. list(REVERSE ${_list_name})
  161. list(REMOVE_DUPLICATES ${_list_name})
  162. list(REVERSE ${_list_name})
  163. endif()
  164. endmacro()
  165. # Test first if the current compilers automatically wrap HDF5
  166. function(_HDF5_test_regular_compiler_C success version is_parallel)
  167. set(scratch_directory
  168. ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5)
  169. if(NOT ${success} OR
  170. NOT EXISTS ${scratch_directory}/compiler_has_h5_c)
  171. set(test_file ${scratch_directory}/cmake_hdf5_test.c)
  172. file(WRITE ${test_file}
  173. "#include <hdf5.h>\n"
  174. "#include <hdf5_hl.h>\n"
  175. "int main(void) {\n"
  176. " char const* info_ver = \"INFO\" \":\" H5_VERSION;\n"
  177. " hid_t fid;\n"
  178. " fid = H5Fcreate(\"foo.h5\",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT);\n"
  179. " return 0;\n"
  180. "}")
  181. try_compile(${success} ${scratch_directory} ${test_file}
  182. COPY_FILE ${scratch_directory}/compiler_has_h5_c
  183. )
  184. endif()
  185. if(${success})
  186. file(STRINGS ${scratch_directory}/compiler_has_h5_c INFO_VER
  187. REGEX "^INFO:([0-9]+\\.[0-9]+\\.[0-9]+)(-patch([0-9]+))?"
  188. )
  189. string(REGEX MATCH "^INFO:([0-9]+\\.[0-9]+\\.[0-9]+)(-patch([0-9]+))?"
  190. INFO_VER "${INFO_VER}"
  191. )
  192. set(${version} ${CMAKE_MATCH_1})
  193. if(CMAKE_MATCH_3)
  194. set(${version} ${HDF5_CXX_VERSION}.${CMAKE_MATCH_3})
  195. endif()
  196. set(${version} ${${version}} PARENT_SCOPE)
  197. execute_process(COMMAND ${CMAKE_C_COMPILER} -showconfig
  198. OUTPUT_VARIABLE config_output
  199. ERROR_VARIABLE config_error
  200. RESULT_VARIABLE config_result
  201. )
  202. if(config_output MATCHES "Parallel HDF5: yes")
  203. set(${is_parallel} TRUE PARENT_SCOPE)
  204. else()
  205. set(${is_parallel} FALSE PARENT_SCOPE)
  206. endif()
  207. endif()
  208. endfunction()
  209. function(_HDF5_test_regular_compiler_CXX success version is_parallel)
  210. set(scratch_directory ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5)
  211. if(NOT ${success} OR
  212. NOT EXISTS ${scratch_directory}/compiler_has_h5_cxx)
  213. set(test_file ${scratch_directory}/cmake_hdf5_test.cxx)
  214. file(WRITE ${test_file}
  215. "#include <H5Cpp.h>\n"
  216. "#ifndef H5_NO_NAMESPACE\n"
  217. "using namespace H5;\n"
  218. "#endif\n"
  219. "int main(int argc, char **argv) {\n"
  220. " char const* info_ver = \"INFO\" \":\" H5_VERSION;\n"
  221. " H5File file(\"foo.h5\", H5F_ACC_TRUNC);\n"
  222. " return 0;\n"
  223. "}")
  224. try_compile(${success} ${scratch_directory} ${test_file}
  225. COPY_FILE ${scratch_directory}/compiler_has_h5_cxx
  226. )
  227. endif()
  228. if(${success})
  229. file(STRINGS ${scratch_directory}/compiler_has_h5_cxx INFO_VER
  230. REGEX "^INFO:([0-9]+\\.[0-9]+\\.[0-9]+)(-patch([0-9]+))?"
  231. )
  232. string(REGEX MATCH "^INFO:([0-9]+\\.[0-9]+\\.[0-9]+)(-patch([0-9]+))?"
  233. INFO_VER "${INFO_VER}"
  234. )
  235. set(${version} ${CMAKE_MATCH_1})
  236. if(CMAKE_MATCH_3)
  237. set(${version} ${HDF5_CXX_VERSION}.${CMAKE_MATCH_3})
  238. endif()
  239. set(${version} ${${version}} PARENT_SCOPE)
  240. execute_process(COMMAND ${CMAKE_CXX_COMPILER} -showconfig
  241. OUTPUT_VARIABLE config_output
  242. ERROR_VARIABLE config_error
  243. RESULT_VARIABLE config_result
  244. )
  245. if(config_output MATCHES "Parallel HDF5: yes")
  246. set(${is_parallel} TRUE PARENT_SCOPE)
  247. else()
  248. set(${is_parallel} FALSE PARENT_SCOPE)
  249. endif()
  250. endif()
  251. endfunction()
  252. function(_HDF5_test_regular_compiler_Fortran success is_parallel)
  253. if(NOT ${success})
  254. set(scratch_directory
  255. ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5)
  256. set(test_file ${scratch_directory}/cmake_hdf5_test.f90)
  257. file(WRITE ${test_file}
  258. "program hdf5_hello\n"
  259. " use hdf5\n"
  260. " use h5lt\n"
  261. " use h5ds\n"
  262. " integer error\n"
  263. " call h5open_f(error)\n"
  264. " call h5close_f(error)\n"
  265. "end\n")
  266. try_compile(${success} ${scratch_directory} ${test_file})
  267. if(${success})
  268. execute_process(COMMAND ${CMAKE_Fortran_COMPILER} -showconfig
  269. OUTPUT_VARIABLE config_output
  270. ERROR_VARIABLE config_error
  271. RESULT_VARIABLE config_result
  272. )
  273. if(config_output MATCHES "Parallel HDF5: yes")
  274. set(${is_parallel} TRUE PARENT_SCOPE)
  275. else()
  276. set(${is_parallel} FALSE PARENT_SCOPE)
  277. endif()
  278. endif()
  279. endif()
  280. endfunction()
  281. # Invoke the HDF5 wrapper compiler. The compiler return value is stored to the
  282. # return_value argument, the text output is stored to the output variable.
  283. macro( _HDF5_invoke_compiler language output return_value version is_parallel)
  284. set(${version})
  285. if(HDF5_USE_STATIC_LIBRARIES)
  286. set(lib_type_args -noshlib)
  287. else()
  288. set(lib_type_args -shlib)
  289. endif()
  290. set(scratch_dir ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5)
  291. if("${language}" STREQUAL "C")
  292. set(test_file ${scratch_dir}/cmake_hdf5_test.c)
  293. elseif("${language}" STREQUAL "CXX")
  294. set(test_file ${scratch_dir}/cmake_hdf5_test.cxx)
  295. elseif("${language}" STREQUAL "Fortran")
  296. set(test_file ${scratch_dir}/cmake_hdf5_test.f90)
  297. endif()
  298. exec_program( ${HDF5_${language}_COMPILER_EXECUTABLE}
  299. ARGS -show ${lib_type_args} ${test_file}
  300. OUTPUT_VARIABLE ${output}
  301. RETURN_VALUE ${return_value}
  302. )
  303. if(NOT ${${return_value}} EQUAL 0)
  304. message(STATUS
  305. "Unable to determine HDF5 ${language} flags from HDF5 wrapper.")
  306. endif()
  307. exec_program( ${HDF5_${language}_COMPILER_EXECUTABLE}
  308. ARGS -showconfig
  309. OUTPUT_VARIABLE config_output
  310. RETURN_VALUE config_return
  311. )
  312. if(NOT ${return_value} EQUAL 0)
  313. message( STATUS
  314. "Unable to determine HDF5 ${language} version from HDF5 wrapper.")
  315. endif()
  316. string(REGEX MATCH "HDF5 Version: ([a-zA-Z0-9\\.\\-]*)" version_match "${config_output}")
  317. if(version_match)
  318. string(REPLACE "HDF5 Version: " "" ${version} "${version_match}")
  319. string(REPLACE "-patch" "." ${version} "${${version}}")
  320. endif()
  321. if(config_output MATCHES "Parallel HDF5: yes")
  322. set(${is_parallel} TRUE)
  323. else()
  324. set(${is_parallel} FALSE)
  325. endif()
  326. endmacro()
  327. # Parse a compile line for definitions, includes, library paths, and libraries.
  328. macro( _HDF5_parse_compile_line
  329. compile_line_var
  330. include_paths
  331. definitions
  332. library_paths
  333. libraries
  334. libraries_hl)
  335. if(UNIX)
  336. separate_arguments(_HDF5_COMPILE_ARGS UNIX_COMMAND "${${compile_line_var}}")
  337. else()
  338. separate_arguments(_HDF5_COMPILE_ARGS WINDOWS_COMMAND "${${compile_line_var}}")
  339. endif()
  340. foreach(arg IN LISTS _HDF5_COMPILE_ARGS)
  341. if("${arg}" MATCHES "^-I(.*)$")
  342. # include directory
  343. list(APPEND ${include_paths} "${CMAKE_MATCH_1}")
  344. elseif("${arg}" MATCHES "^-D(.*)$")
  345. # compile definition
  346. list(APPEND ${definitions} "-D${CMAKE_MATCH_1}")
  347. elseif("${arg}" MATCHES "^-L(.*)$")
  348. # library search path
  349. list(APPEND ${library_paths} "${CMAKE_MATCH_1}")
  350. elseif("${arg}" MATCHES "^-l(hdf5.*hl.*)$")
  351. # library name (hl)
  352. list(APPEND ${libraries_hl} "${CMAKE_MATCH_1}")
  353. elseif("${arg}" MATCHES "^-l(.*)$")
  354. # library name
  355. list(APPEND ${libraries} "${CMAKE_MATCH_1}")
  356. elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.(a|so|dylib|sl|lib)$")
  357. # library file
  358. if(NOT EXISTS "${arg}")
  359. continue()
  360. endif()
  361. get_filename_component(_HDF5_LPATH "${arg}" DIRECTORY)
  362. get_filename_component(_HDF5_LNAME "${arg}" NAME_WE)
  363. string(REGEX REPLACE "^lib" "" _HDF5_LNAME "${_HDF5_LNAME}")
  364. list(APPEND ${library_paths} "${_HDF5_LPATH}")
  365. if(_HDF5_LNAME MATCHES "hdf5.*hl")
  366. list(APPEND ${libraries_hl} "${_HDF5_LNAME}")
  367. else()
  368. list(APPEND ${libraries} "${_HDF5_LNAME}")
  369. endif()
  370. endif()
  371. endforeach()
  372. endmacro()
  373. if(NOT HDF5_ROOT)
  374. set(HDF5_ROOT $ENV{HDF5_ROOT})
  375. endif()
  376. if(HDF5_ROOT)
  377. set(_HDF5_SEARCH_OPTS NO_DEFAULT_PATH)
  378. else()
  379. set(_HDF5_SEARCH_OPTS)
  380. endif()
  381. # Try to find HDF5 using an installed hdf5-config.cmake
  382. if(NOT HDF5_FOUND)
  383. find_package(HDF5 QUIET NO_MODULE
  384. HINTS ${HDF5_ROOT}
  385. ${_HDF5_SEARCH_OPTS}
  386. )
  387. if( HDF5_FOUND)
  388. if(HDF5_FIND_DEBUG)
  389. message(STATUS "Found HDF5 at ${HDF5_DIR} via NO_MODULE. Now trying to extract locations etc.")
  390. endif()
  391. set(HDF5_IS_PARALLEL ${HDF5_ENABLE_PARALLEL})
  392. set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR})
  393. set(HDF5_LIBRARIES)
  394. if (NOT TARGET hdf5 AND NOT TARGET hdf5-static AND NOT TARGET hdf5-shared)
  395. # Some HDF5 versions (e.g. 1.8.18) used hdf5::hdf5 etc
  396. set(_target_prefix "hdf5::")
  397. endif()
  398. set(HDF5_C_TARGET ${_target_prefix}hdf5)
  399. set(HDF5_C_HL_TARGET ${_target_prefix}hdf5_hl)
  400. set(HDF5_CXX_TARGET ${_target_prefix}hdf5_cpp)
  401. set(HDF5_CXX_HL_TARGET ${_target_prefix}hdf5_hl_cpp)
  402. set(HDF5_Fortran_TARGET ${_target_prefix}hdf5_fortran)
  403. set(HDF5_Fortran_HL_TARGET ${_target_prefix}hdf5_hl_fortran)
  404. set(HDF5_DEFINITIONS "")
  405. if(HDF5_USE_STATIC_LIBRARIES)
  406. set(_suffix "-static")
  407. else()
  408. set(_suffix "-shared")
  409. endif()
  410. foreach(_lang ${HDF5_LANGUAGE_BINDINGS})
  411. #Older versions of hdf5 don't have a static/shared suffix so
  412. #if we detect that occurrence clear the suffix
  413. if(_suffix AND NOT TARGET ${HDF5_${_lang}_TARGET}${_suffix})
  414. if(NOT TARGET ${HDF5_${_lang}_TARGET})
  415. #cant find this component with or without the suffix
  416. #so bail out, and let the following locate HDF5
  417. set(HDF5_FOUND FALSE)
  418. break()
  419. endif()
  420. set(_suffix "")
  421. endif()
  422. if(HDF5_FIND_DEBUG)
  423. message(STATUS "Trying to get properties of target ${HDF5_${_lang}_TARGET}${_suffix}")
  424. endif()
  425. # Find library for this target. Complicated as on Windows with a DLL, we need to search for the import-lib.
  426. get_target_property(_imported_conf ${HDF5_${_lang}_TARGET}${_suffix} IMPORTED_CONFIGURATIONS)
  427. get_target_property(_lang_location ${HDF5_${_lang}_TARGET}${_suffix} IMPORTED_IMPLIB_${_imported_conf} )
  428. if (NOT _lang_location)
  429. # no import lib, just try LOCATION
  430. get_target_property(_lang_location ${HDF5_${_lang}_TARGET}${_suffix} LOCATION)
  431. endif()
  432. if( _lang_location )
  433. set(HDF5_${_lang}_LIBRARY ${_lang_location})
  434. list(APPEND HDF5_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix})
  435. set(HDF5_${_lang}_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix})
  436. set(HDF5_${_lang}_FOUND True)
  437. endif()
  438. if(FIND_HL)
  439. get_target_property(__lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} IMPORTED_IMPLIB_${_imported_conf} )
  440. if (NOT _lang_hl_location)
  441. get_target_property(_lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} LOCATION)
  442. endif()
  443. if( _lang_hl_location )
  444. set(HDF5_${_lang}_HL_LIBRARY ${_lang_hl_location})
  445. list(APPEND HDF5_HL_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix})
  446. set(HDF5_${_lang}_HL_LIBRARIES ${HDF5_${_lang}_TARGET}${_suffix})
  447. set(HDF5_HL_FOUND True)
  448. endif()
  449. endif()
  450. endforeach()
  451. endif()
  452. endif()
  453. if(NOT HDF5_FOUND)
  454. set(_HDF5_NEED_TO_SEARCH False)
  455. set(HDF5_COMPILER_NO_INTERROGATE True)
  456. # Only search for languages we've enabled
  457. foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS)
  458. # First check to see if our regular compiler is one of wrappers
  459. if(__lang STREQUAL "C")
  460. _HDF5_test_regular_compiler_C(
  461. HDF5_${__lang}_COMPILER_NO_INTERROGATE
  462. HDF5_${__lang}_VERSION
  463. HDF5_${__lang}_IS_PARALLEL)
  464. elseif(__lang STREQUAL "CXX")
  465. _HDF5_test_regular_compiler_CXX(
  466. HDF5_${__lang}_COMPILER_NO_INTERROGATE
  467. HDF5_${__lang}_VERSION
  468. HDF5_${__lang}_IS_PARALLEL)
  469. elseif(__lang STREQUAL "Fortran")
  470. _HDF5_test_regular_compiler_Fortran(
  471. HDF5_${__lang}_COMPILER_NO_INTERROGATE
  472. HDF5_${__lang}_IS_PARALLEL)
  473. else()
  474. continue()
  475. endif()
  476. if(HDF5_${__lang}_COMPILER_NO_INTERROGATE)
  477. message(STATUS "HDF5: Using hdf5 compiler wrapper for all ${__lang} compiling")
  478. set(HDF5_${__lang}_FOUND True)
  479. set(HDF5_${__lang}_COMPILER_EXECUTABLE_NO_INTERROGATE
  480. "${CMAKE_${__lang}_COMPILER}"
  481. CACHE FILEPATH "HDF5 ${__lang} compiler wrapper")
  482. set(HDF5_${__lang}_DEFINITIONS)
  483. set(HDF5_${__lang}_INCLUDE_DIRS)
  484. set(HDF5_${__lang}_LIBRARIES)
  485. set(HDF5_${__lang}_HL_LIBRARIES)
  486. mark_as_advanced(HDF5_${__lang}_COMPILER_EXECUTABLE_NO_INTERROGATE)
  487. set(HDF5_${__lang}_FOUND True)
  488. set(HDF5_HL_FOUND True)
  489. else()
  490. set(HDF5_COMPILER_NO_INTERROGATE False)
  491. # If this language isn't using the wrapper, then try to seed the
  492. # search options with the wrapper
  493. find_program(HDF5_${__lang}_COMPILER_EXECUTABLE
  494. NAMES ${HDF5_${__lang}_COMPILER_NAMES} NAMES_PER_DIR
  495. HINTS ${HDF5_ROOT}
  496. PATH_SUFFIXES bin Bin
  497. DOC "HDF5 ${__lang} Wrapper compiler. Used only to detect HDF5 compile flags."
  498. ${_HDF5_SEARCH_OPTS}
  499. )
  500. mark_as_advanced( HDF5_${__lang}_COMPILER_EXECUTABLE )
  501. unset(HDF5_${__lang}_COMPILER_NAMES)
  502. if(HDF5_${__lang}_COMPILER_EXECUTABLE)
  503. _HDF5_invoke_compiler(${__lang} HDF5_${__lang}_COMPILE_LINE
  504. HDF5_${__lang}_RETURN_VALUE HDF5_${__lang}_VERSION HDF5_${__lang}_IS_PARALLEL)
  505. if(HDF5_${__lang}_RETURN_VALUE EQUAL 0)
  506. message(STATUS "HDF5: Using hdf5 compiler wrapper to determine ${__lang} configuration")
  507. _HDF5_parse_compile_line( HDF5_${__lang}_COMPILE_LINE
  508. HDF5_${__lang}_INCLUDE_DIRS
  509. HDF5_${__lang}_DEFINITIONS
  510. HDF5_${__lang}_LIBRARY_DIRS
  511. HDF5_${__lang}_LIBRARY_NAMES
  512. HDF5_${__lang}_HL_LIBRARY_NAMES
  513. )
  514. set(HDF5_${__lang}_LIBRARIES)
  515. foreach(L IN LISTS HDF5_${__lang}_LIBRARY_NAMES)
  516. set(_HDF5_SEARCH_NAMES_LOCAL)
  517. if("x${L}" MATCHES "hdf5")
  518. # hdf5 library
  519. set(_HDF5_SEARCH_OPTS_LOCAL ${_HDF5_SEARCH_OPTS})
  520. if(UNIX AND HDF5_USE_STATIC_LIBRARIES)
  521. set(_HDF5_SEARCH_NAMES_LOCAL lib${L}.a)
  522. endif()
  523. else()
  524. # external library
  525. set(_HDF5_SEARCH_OPTS_LOCAL)
  526. endif()
  527. find_library(HDF5_${__lang}_LIBRARY_${L}
  528. NAMES ${_HDF5_SEARCH_NAMES_LOCAL} ${L} NAMES_PER_DIR
  529. HINTS ${HDF5_${__lang}_LIBRARY_DIRS}
  530. ${HDF5_ROOT}
  531. ${_HDF5_SEARCH_OPTS_LOCAL}
  532. )
  533. unset(_HDF5_SEARCH_OPTS_LOCAL)
  534. unset(_HDF5_SEARCH_NAMES_LOCAL)
  535. if(HDF5_${__lang}_LIBRARY_${L})
  536. list(APPEND HDF5_${__lang}_LIBRARIES ${HDF5_${__lang}_LIBRARY_${L}})
  537. else()
  538. list(APPEND HDF5_${__lang}_LIBRARIES ${L})
  539. endif()
  540. endforeach()
  541. if(FIND_HL)
  542. set(HDF5_${__lang}_HL_LIBRARIES)
  543. foreach(L IN LISTS HDF5_${__lang}_HL_LIBRARY_NAMES)
  544. set(_HDF5_SEARCH_NAMES_LOCAL)
  545. if("x${L}" MATCHES "hdf5")
  546. # hdf5 library
  547. set(_HDF5_SEARCH_OPTS_LOCAL ${_HDF5_SEARCH_OPTS})
  548. if(UNIX AND HDF5_USE_STATIC_LIBRARIES)
  549. set(_HDF5_SEARCH_NAMES_LOCAL lib${L}.a)
  550. endif()
  551. else()
  552. # external library
  553. set(_HDF5_SEARCH_OPTS_LOCAL)
  554. endif()
  555. find_library(HDF5_${__lang}_LIBRARY_${L}
  556. NAMES ${_HDF5_SEARCH_NAMES_LOCAL} ${L} NAMES_PER_DIR
  557. HINTS ${HDF5_${__lang}_LIBRARY_DIRS}
  558. ${HDF5_ROOT}
  559. ${_HDF5_SEARCH_OPTS_LOCAL}
  560. )
  561. unset(_HDF5_SEARCH_OPTS_LOCAL)
  562. unset(_HDF5_SEARCH_NAMES_LOCAL)
  563. if(HDF5_${__lang}_LIBRARY_${L})
  564. list(APPEND HDF5_${__lang}_HL_LIBRARIES ${HDF5_${__lang}_LIBRARY_${L}})
  565. else()
  566. list(APPEND HDF5_${__lang}_HL_LIBRARIES ${L})
  567. endif()
  568. endforeach()
  569. set(HDF5_HL_FOUND True)
  570. endif()
  571. set(HDF5_${__lang}_FOUND True)
  572. _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_DEFINITIONS)
  573. _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_INCLUDE_DIRS)
  574. _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_LIBRARIES)
  575. _HDF5_remove_duplicates_from_beginning(HDF5_${__lang}_HL_LIBRARIES)
  576. else()
  577. set(_HDF5_NEED_TO_SEARCH True)
  578. endif()
  579. else()
  580. set(_HDF5_NEED_TO_SEARCH True)
  581. endif()
  582. endif()
  583. if(HDF5_${__lang}_VERSION)
  584. if(NOT HDF5_VERSION)
  585. set(HDF5_VERSION ${HDF5_${__lang}_VERSION})
  586. elseif(NOT HDF5_VERSION VERSION_EQUAL HDF5_${__lang}_VERSION)
  587. message(WARNING "HDF5 Version found for language ${__lang}, ${HDF5_${__lang}_VERSION} is different than previously found version ${HDF5_VERSION}")
  588. endif()
  589. endif()
  590. if(DEFINED HDF5_${__lang}_IS_PARALLEL)
  591. if(NOT DEFINED HDF5_IS_PARALLEL)
  592. set(HDF5_IS_PARALLEL ${HDF5_${__lang}_IS_PARALLEL})
  593. elseif(NOT HDF5_IS_PARALLEL AND HDF5_${__lang}_IS_PARALLEL)
  594. message(WARNING "HDF5 found for language ${__lang} is parallel but previously found language is not parallel.")
  595. elseif(HDF5_IS_PARALLEL AND NOT HDF5_${__lang}_IS_PARALLEL)
  596. message(WARNING "HDF5 found for language ${__lang} is not parallel but previously found language is parallel.")
  597. endif()
  598. endif()
  599. endforeach()
  600. else()
  601. set(_HDF5_NEED_TO_SEARCH True)
  602. endif()
  603. if(NOT HDF5_FOUND AND HDF5_COMPILER_NO_INTERROGATE)
  604. # No arguments necessary, all languages can use the compiler wrappers
  605. set(HDF5_FOUND True)
  606. set(HDF5_METHOD "Included by compiler wrappers")
  607. set(HDF5_REQUIRED_VARS HDF5_METHOD)
  608. elseif(NOT HDF5_FOUND AND NOT _HDF5_NEED_TO_SEARCH)
  609. # Compiler wrappers aren't being used by the build but were found and used
  610. # to determine necessary include and library flags
  611. set(HDF5_INCLUDE_DIRS)
  612. set(HDF5_LIBRARIES)
  613. set(HDF5_HL_LIBRARIES)
  614. foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS)
  615. if(HDF5_${__lang}_FOUND)
  616. if(NOT HDF5_${__lang}_COMPILER_NO_INTERROGATE)
  617. list(APPEND HDF5_DEFINITIONS ${HDF5_${__lang}_DEFINITIONS})
  618. list(APPEND HDF5_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIRS})
  619. list(APPEND HDF5_LIBRARIES ${HDF5_${__lang}_LIBRARIES})
  620. if(FIND_HL)
  621. list(APPEND HDF5_HL_LIBRARIES ${HDF5_${__lang}_HL_LIBRARIES})
  622. endif()
  623. endif()
  624. endif()
  625. endforeach()
  626. _HDF5_remove_duplicates_from_beginning(HDF5_DEFINITIONS)
  627. _HDF5_remove_duplicates_from_beginning(HDF5_INCLUDE_DIRS)
  628. _HDF5_remove_duplicates_from_beginning(HDF5_LIBRARIES)
  629. _HDF5_remove_duplicates_from_beginning(HDF5_HL_LIBRARIES)
  630. set(HDF5_FOUND True)
  631. set(HDF5_REQUIRED_VARS HDF5_LIBRARIES)
  632. if(FIND_HL)
  633. list(APPEND HDF5_REQUIRED_VARS HDF5_HL_LIBRARIES)
  634. endif()
  635. endif()
  636. find_program( HDF5_DIFF_EXECUTABLE
  637. NAMES h5diff
  638. HINTS ${HDF5_ROOT}
  639. PATH_SUFFIXES bin Bin
  640. ${_HDF5_SEARCH_OPTS}
  641. DOC "HDF5 file differencing tool." )
  642. mark_as_advanced( HDF5_DIFF_EXECUTABLE )
  643. if( NOT HDF5_FOUND )
  644. # seed the initial lists of libraries to find with items we know we need
  645. set(HDF5_C_LIBRARY_NAMES hdf5)
  646. set(HDF5_C_HL_LIBRARY_NAMES hdf5_hl)
  647. set(HDF5_CXX_LIBRARY_NAMES hdf5_cpp ${HDF5_C_LIBRARY_NAMES})
  648. set(HDF5_CXX_HL_LIBRARY_NAMES hdf5_hl_cpp ${HDF5_C_HL_LIBRARY_NAMES} ${HDF5_CXX_LIBRARY_NAMES})
  649. set(HDF5_Fortran_LIBRARY_NAMES hdf5_fortran ${HDF5_C_LIBRARY_NAMES})
  650. set(HDF5_Fortran_HL_LIBRARY_NAMES hdf5hl_fortran ${HDF5_C_HL_LIBRARY_NAMES} ${HDF5_Fortran_LIBRARY_NAMES})
  651. foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS)
  652. # find the HDF5 include directories
  653. if("${__lang}" STREQUAL "Fortran")
  654. set(HDF5_INCLUDE_FILENAME hdf5.mod)
  655. elseif("${__lang}" STREQUAL "CXX")
  656. set(HDF5_INCLUDE_FILENAME H5Cpp.h)
  657. else()
  658. set(HDF5_INCLUDE_FILENAME hdf5.h)
  659. endif()
  660. find_path(HDF5_${__lang}_INCLUDE_DIR ${HDF5_INCLUDE_FILENAME}
  661. HINTS ${HDF5_ROOT}
  662. PATHS $ENV{HOME}/.local/include
  663. PATH_SUFFIXES include Include
  664. ${_HDF5_SEARCH_OPTS}
  665. )
  666. mark_as_advanced(HDF5_${__lang}_INCLUDE_DIR)
  667. # set the _DIRS variable as this is what the user will normally use
  668. set(HDF5_${__lang}_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIR})
  669. list(APPEND HDF5_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIR})
  670. # find the HDF5 libraries
  671. foreach(LIB IN LISTS HDF5_${__lang}_LIBRARY_NAMES)
  672. if(UNIX AND HDF5_USE_STATIC_LIBRARIES)
  673. # According to bug 1643 on the CMake bug tracker, this is the
  674. # preferred method for searching for a static library.
  675. # See https://gitlab.kitware.com/cmake/cmake/issues/1643. We search
  676. # first for the full static library name, but fall back to a
  677. # generic search on the name if the static search fails.
  678. set( THIS_LIBRARY_SEARCH_DEBUG
  679. lib${LIB}d.a lib${LIB}_debug.a ${LIB}d ${LIB}_debug
  680. lib${LIB}d-static.a lib${LIB}_debug-static.a ${LIB}d-static ${LIB}_debug-static )
  681. set( THIS_LIBRARY_SEARCH_RELEASE lib${LIB}.a ${LIB} lib${LIB}-static.a ${LIB}-static)
  682. else()
  683. set( THIS_LIBRARY_SEARCH_DEBUG ${LIB}d ${LIB}_debug ${LIB}d-shared ${LIB}_debug-shared)
  684. set( THIS_LIBRARY_SEARCH_RELEASE ${LIB} ${LIB}-shared)
  685. endif()
  686. find_library(HDF5_${LIB}_LIBRARY_DEBUG
  687. NAMES ${THIS_LIBRARY_SEARCH_DEBUG}
  688. HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib
  689. ${_HDF5_SEARCH_OPTS}
  690. )
  691. find_library( HDF5_${LIB}_LIBRARY_RELEASE
  692. NAMES ${THIS_LIBRARY_SEARCH_RELEASE}
  693. HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib
  694. ${_HDF5_SEARCH_OPTS}
  695. )
  696. select_library_configurations( HDF5_${LIB} )
  697. list(APPEND HDF5_${__lang}_LIBRARIES ${HDF5_${LIB}_LIBRARY})
  698. endforeach()
  699. if(HDF5_${__lang}_LIBRARIES)
  700. set(HDF5_${__lang}_FOUND True)
  701. endif()
  702. # Append the libraries for this language binding to the list of all
  703. # required libraries.
  704. list(APPEND HDF5_LIBRARIES ${HDF5_${__lang}_LIBRARIES})
  705. if(FIND_HL)
  706. foreach(LIB IN LISTS HDF5_${__lang}_HL_LIBRARY_NAMES)
  707. if(UNIX AND HDF5_USE_STATIC_LIBRARIES)
  708. # According to bug 1643 on the CMake bug tracker, this is the
  709. # preferred method for searching for a static library.
  710. # See https://gitlab.kitware.com/cmake/cmake/issues/1643. We search
  711. # first for the full static library name, but fall back to a
  712. # generic search on the name if the static search fails.
  713. set( THIS_LIBRARY_SEARCH_DEBUG
  714. lib${LIB}d.a lib${LIB}_debug.a ${LIB}d ${LIB}_debug
  715. lib${LIB}d-static.a lib${LIB}_debug-static.a ${LIB}d-static ${LIB}_debug-static )
  716. set( THIS_LIBRARY_SEARCH_RELEASE lib${LIB}.a ${LIB} lib${LIB}-static.a ${LIB}-static)
  717. else()
  718. set( THIS_LIBRARY_SEARCH_DEBUG ${LIB}d ${LIB}_debug ${LIB}d-shared ${LIB}_debug-shared)
  719. set( THIS_LIBRARY_SEARCH_RELEASE ${LIB} ${LIB}-shared)
  720. endif()
  721. find_library(HDF5_${LIB}_LIBRARY_DEBUG
  722. NAMES ${THIS_LIBRARY_SEARCH_DEBUG}
  723. HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib
  724. ${_HDF5_SEARCH_OPTS}
  725. )
  726. find_library( HDF5_${LIB}_LIBRARY_RELEASE
  727. NAMES ${THIS_LIBRARY_SEARCH_RELEASE}
  728. HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib
  729. ${_HDF5_SEARCH_OPTS}
  730. )
  731. select_library_configurations( HDF5_${LIB} )
  732. list(APPEND HDF5_${__lang}_HL_LIBRARIES ${HDF5_${LIB}_LIBRARY})
  733. endforeach()
  734. # Append the libraries for this language binding to the list of all
  735. # required libraries.
  736. list(APPEND HDF5_HL_LIBRARIES ${HDF5_${__lang}_HL_LIBRARIES})
  737. endif()
  738. endforeach()
  739. if(FIND_HL AND HDF5_HL_LIBRARIES)
  740. set(HDF5_HL_FOUND True)
  741. endif()
  742. _HDF5_remove_duplicates_from_beginning(HDF5_INCLUDE_DIRS)
  743. _HDF5_remove_duplicates_from_beginning(HDF5_LIBRARIES)
  744. _HDF5_remove_duplicates_from_beginning(HDF5_HL_LIBRARIES)
  745. # If the HDF5 include directory was found, open H5pubconf.h to determine if
  746. # HDF5 was compiled with parallel IO support
  747. set( HDF5_IS_PARALLEL FALSE )
  748. set( HDF5_VERSION "" )
  749. foreach( _dir IN LISTS HDF5_INCLUDE_DIRS )
  750. foreach(_hdr "${_dir}/H5pubconf.h" "${_dir}/H5pubconf-64.h" "${_dir}/H5pubconf-32.h")
  751. if( EXISTS "${_hdr}" )
  752. file( STRINGS "${_hdr}"
  753. HDF5_HAVE_PARALLEL_DEFINE
  754. REGEX "HAVE_PARALLEL 1" )
  755. if( HDF5_HAVE_PARALLEL_DEFINE )
  756. set( HDF5_IS_PARALLEL TRUE )
  757. endif()
  758. unset(HDF5_HAVE_PARALLEL_DEFINE)
  759. file( STRINGS "${_hdr}"
  760. HDF5_VERSION_DEFINE
  761. REGEX "^[ \t]*#[ \t]*define[ \t]+H5_VERSION[ \t]+" )
  762. if( "${HDF5_VERSION_DEFINE}" MATCHES
  763. "H5_VERSION[ \t]+\"([0-9]+\\.[0-9]+\\.[0-9]+)(-patch([0-9]+))?\"" )
  764. set( HDF5_VERSION "${CMAKE_MATCH_1}" )
  765. if( CMAKE_MATCH_3 )
  766. set( HDF5_VERSION ${HDF5_VERSION}.${CMAKE_MATCH_3})
  767. endif()
  768. endif()
  769. unset(HDF5_VERSION_DEFINE)
  770. endif()
  771. endforeach()
  772. endforeach()
  773. set( HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL
  774. "HDF5 library compiled with parallel IO support" )
  775. mark_as_advanced( HDF5_IS_PARALLEL )
  776. set(HDF5_REQUIRED_VARS HDF5_LIBRARIES HDF5_INCLUDE_DIRS)
  777. if(FIND_HL)
  778. list(APPEND HDF5_REQUIRED_VARS HDF5_HL_LIBRARIES)
  779. endif()
  780. endif()
  781. # For backwards compatibility we set HDF5_INCLUDE_DIR to the value of
  782. # HDF5_INCLUDE_DIRS
  783. if( HDF5_INCLUDE_DIRS )
  784. set( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" )
  785. endif()
  786. # If HDF5_REQUIRED_VARS is empty at this point, then it's likely that
  787. # something external is trying to explicitly pass already found
  788. # locations
  789. if(NOT HDF5_REQUIRED_VARS)
  790. set(HDF5_REQUIRED_VARS HDF5_LIBRARIES HDF5_INCLUDE_DIRS)
  791. endif()
  792. find_package_handle_standard_args(HDF5
  793. REQUIRED_VARS ${HDF5_REQUIRED_VARS}
  794. VERSION_VAR HDF5_VERSION
  795. HANDLE_COMPONENTS
  796. )
  797. unset(_HDF5_SEARCH_OPTS)
  798. if( HDF5_FOUND AND NOT HDF5_DIR)
  799. # hide HDF5_DIR for the non-advanced user to avoid confusion with
  800. # HDF5_DIR-NOT_FOUND while HDF5 was found.
  801. mark_as_advanced(HDF5_DIR)
  802. endif()
  803. if (HDF5_FIND_DEBUG)
  804. message(STATUS "HDF5_DIR: ${HDF5_DIR}")
  805. message(STATUS "HDF5_DEFINITIONS: ${HDF5_DEFINITIONS}")
  806. message(STATUS "HDF5_INCLUDE_DIRS: ${HDF5_INCLUDE_DIRS}")
  807. message(STATUS "HDF5_LIBRARIES: ${HDF5_LIBRARIES}")
  808. foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS)
  809. message(STATUS "HDF5_${__lang}_DEFINITIONS: ${HDF5_${__lang}_DEFINITIONS}")
  810. message(STATUS "HDF5_${__lang}_INCLUDE_DIR: ${HDF5_${__lang}_INCLUDE_DIR}")
  811. message(STATUS "HDF5_${__lang}_INCLUDE_DIRS: ${HDF5_${__lang}_INCLUDE_DIRS}")
  812. message(STATUS "HDF5_${__lang}_LIBRARY: ${HDF5_${__lang}_LIBRARY}")
  813. message(STATUS "HDF5_${__lang}_LIBRARIES: ${HDF5_${__lang}_LIBRARIES}")
  814. endforeach()
  815. endif()