hdf5-config.cmake 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. #
  2. # Copyright by The HDF Group.
  3. # All rights reserved.
  4. #
  5. # This file is part of HDF5. The full HDF5 copyright notice, including
  6. # terms governing use, modification, and redistribution, is contained in
  7. # the COPYING file, which can be found at the root of the source code
  8. # distribution tree, or in https://www.hdfgroup.org/licenses.
  9. # If you do not have access to either file, you may request a copy from
  10. # help@hdfgroup.org.
  11. #
  12. #-----------------------------------------------------------------------------
  13. # HDF5 Config file for compiling against hdf5 build/install directory
  14. #-----------------------------------------------------------------------------
  15. ####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
  16. ####### Any changes to this file will be overwritten by the next CMake run ####
  17. ####### The input file was hdf5-config.cmake.in ########
  18. get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../" ABSOLUTE)
  19. macro(set_and_check _var _file)
  20. set(${_var} "${_file}")
  21. if(NOT EXISTS "${_file}")
  22. message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
  23. endif()
  24. endmacro()
  25. macro(check_required_components _NAME)
  26. foreach(comp ${${_NAME}_FIND_COMPONENTS})
  27. if(NOT ${_NAME}_${comp}_FOUND)
  28. if(${_NAME}_FIND_REQUIRED_${comp})
  29. set(${_NAME}_FOUND FALSE)
  30. endif()
  31. endif()
  32. endforeach()
  33. endmacro()
  34. ####################################################################################
  35. string(TOUPPER hdf5 HDF5_PACKAGE_NAME)
  36. set (${HDF5_PACKAGE_NAME}_VALID_COMPONENTS
  37. static
  38. shared
  39. C
  40. CXX
  41. Fortran
  42. HL
  43. CXX_HL
  44. Fortran_HL
  45. Java
  46. Tools
  47. )
  48. #-----------------------------------------------------------------------------
  49. # User Options
  50. #-----------------------------------------------------------------------------
  51. set (${HDF5_PACKAGE_NAME}_ENABLE_PARALLEL OFF)
  52. set (${HDF5_PACKAGE_NAME}_BUILD_FORTRAN NO)
  53. set (${HDF5_PACKAGE_NAME}_BUILD_CPP_LIB YES)
  54. set (${HDF5_PACKAGE_NAME}_BUILD_JAVA NO)
  55. set (${HDF5_PACKAGE_NAME}_BUILD_TOOLS YES)
  56. set (${HDF5_PACKAGE_NAME}_BUILD_HL_LIB YES)
  57. set (${HDF5_PACKAGE_NAME}_BUILD_HL_TOOLS YES)
  58. set (${HDF5_PACKAGE_NAME}_ENABLE_THREADSAFE OFF)
  59. set (${HDF5_PACKAGE_NAME}_ENABLE_PLUGIN_SUPPORT OFF)
  60. set (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT OFF)
  61. set (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT OFF)
  62. set (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_ENCODING )
  63. set (${HDF5_PACKAGE_NAME}_BUILD_SHARED_LIBS YES)
  64. set (${HDF5_PACKAGE_NAME}_BUILD_STATIC_LIBS NO)
  65. set (${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS OFF)
  66. set (${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES hdf5-static;hdf5-shared;hdf5_tools-static;hdf5_tools-shared;hdf5_hl-static;hdf5_hl-shared;hdf5_cpp-static;hdf5_cpp-shared;hdf5_hl_cpp-static;hdf5_hl_cpp-shared)
  67. set (${HDF5_PACKAGE_NAME}_ARCHITECTURE "")
  68. set (${HDF5_PACKAGE_NAME}_TOOLSET "")
  69. set (${HDF5_PACKAGE_NAME}_DEFAULT_API_VERSION "v114")
  70. set (${HDF5_PACKAGE_NAME}_PARALLEL_FILTERED_WRITES "")
  71. #-----------------------------------------------------------------------------
  72. # Dependencies
  73. #-----------------------------------------------------------------------------
  74. if (${HDF5_PACKAGE_NAME}_ENABLE_PARALLEL)
  75. set (${HDF5_PACKAGE_NAME}_MPI_C_INCLUDE_PATH "")
  76. set (${HDF5_PACKAGE_NAME}_MPI_C_LIBRARIES "")
  77. if (${HDF5_PACKAGE_NAME}_BUILD_FORTRAN)
  78. set (${HDF5_PACKAGE_NAME}_MPI_Fortran_INCLUDE_PATH "")
  79. set (${HDF5_PACKAGE_NAME}_MPI_Fortran_LIBRARIES "")
  80. endif ()
  81. endif ()
  82. if (${HDF5_PACKAGE_NAME}_BUILD_JAVA)
  83. set (${HDF5_PACKAGE_NAME}_JAVA_INCLUDE_DIRS
  84. ${PACKAGE_PREFIX_DIR}/lib/jarhdf5-1.13.1.jar
  85. ${PACKAGE_PREFIX_DIR}/lib/slf4j-api-1.7.33.jar
  86. ${PACKAGE_PREFIX_DIR}/lib/slf4j-nop-1.7.33.jar
  87. )
  88. set (${HDF5_PACKAGE_NAME}_JAVA_LIBRARY "${PACKAGE_PREFIX_DIR}/lib")
  89. set (${HDF5_PACKAGE_NAME}_JAVA_LIBRARIES "${${HDF5_PACKAGE_NAME}_JAVA_LIBRARY}")
  90. endif ()
  91. #-----------------------------------------------------------------------------
  92. # Directories
  93. #-----------------------------------------------------------------------------
  94. set (${HDF5_PACKAGE_NAME}_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include" "${${HDF5_PACKAGE_NAME}_MPI_C_INCLUDE_DIRS}")
  95. set (${HDF5_PACKAGE_NAME}_SHARE_DIR "${PACKAGE_PREFIX_DIR}/cmake")
  96. set_and_check (${HDF5_PACKAGE_NAME}_BUILD_DIR "${PACKAGE_PREFIX_DIR}")
  97. if (${HDF5_PACKAGE_NAME}_BUILD_CPP_LIB)
  98. set (${HDF5_PACKAGE_NAME}_INCLUDE_DIR_CPP "${PACKAGE_PREFIX_DIR}/include")
  99. endif ()
  100. if (${HDF5_PACKAGE_NAME}_BUILD_HL_LIB)
  101. set (${HDF5_PACKAGE_NAME}_INCLUDE_DIR_HL "${PACKAGE_PREFIX_DIR}/include")
  102. endif ()
  103. if (${HDF5_PACKAGE_NAME}_BUILD_HL_LIB AND ${HDF5_PACKAGE_NAME}_BUILD_CPP_LIB)
  104. set (${HDF5_PACKAGE_NAME}_INCLUDE_DIR_HL_CPP "${PACKAGE_PREFIX_DIR}/include")
  105. endif ()
  106. if (${HDF5_PACKAGE_NAME}_BUILD_TOOLS)
  107. set (${HDF5_PACKAGE_NAME}_INCLUDE_DIR_TOOLS "${PACKAGE_PREFIX_DIR}/include")
  108. set_and_check (${HDF5_PACKAGE_NAME}_TOOLS_DIR "${PACKAGE_PREFIX_DIR}/bin")
  109. endif ()
  110. #-----------------------------------------------------------------------------
  111. # Version Strings
  112. #-----------------------------------------------------------------------------
  113. set (${HDF5_PACKAGE_NAME}_VERSION_STRING 1.13.1)
  114. set (${HDF5_PACKAGE_NAME}_VERSION_MAJOR 1.13)
  115. set (${HDF5_PACKAGE_NAME}_VERSION_MINOR 1)
  116. #-----------------------------------------------------------------------------
  117. # Don't include targets if this file is being picked up by another
  118. # project which has already built hdf5 as a subproject
  119. #-----------------------------------------------------------------------------
  120. if (NOT TARGET "hdf5")
  121. if (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS)
  122. include (${PACKAGE_PREFIX_DIR}/cmake/-targets.cmake)
  123. endif ()
  124. if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS)
  125. include (${PACKAGE_PREFIX_DIR}/cmake/-targets.cmake)
  126. endif ()
  127. include (${PACKAGE_PREFIX_DIR}/cmake/hdf5-targets.cmake)
  128. endif ()
  129. # Handle default component(static) :
  130. if (NOT ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS)
  131. if (${HDF5_PACKAGE_NAME}_BUILD_STATIC_LIBS)
  132. set (${HDF5_PACKAGE_NAME}_LIB_TYPE)
  133. set (${HDF5_PACKAGE_NAME}_FIND_COMPONENTS C HL static)
  134. set (${HDF5_PACKAGE_NAME}_FIND_REQUIRED_static_C true)
  135. else ()
  136. set (${HDF5_PACKAGE_NAME}_LIB_TYPE)
  137. set (${HDF5_PACKAGE_NAME}_FIND_COMPONENTS C HL shared)
  138. set (${HDF5_PACKAGE_NAME}_FIND_REQUIRED_shared_C true)
  139. endif ()
  140. endif ()
  141. # Handle requested components:
  142. list (REMOVE_DUPLICATES ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS)
  143. foreach (comp IN LISTS ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS)
  144. if (comp STREQUAL "shared")
  145. list (REMOVE_ITEM ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS ${comp})
  146. set (${HDF5_PACKAGE_NAME}_LIB_TYPE ${${HDF5_PACKAGE_NAME}_LIB_TYPE} ${comp})
  147. if (${HDF5_PACKAGE_NAME}_BUILD_FORTRAN)
  148. set (${HDF5_PACKAGE_NAME}_INCLUDE_DIR_FORTRAN "${PACKAGE_PREFIX_DIR}/include/shared")
  149. endif ()
  150. elseif (comp STREQUAL "static")
  151. list (REMOVE_ITEM ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS ${comp})
  152. set (${HDF5_PACKAGE_NAME}_LIB_TYPE ${${HDF5_PACKAGE_NAME}_LIB_TYPE} ${comp})
  153. if (${HDF5_PACKAGE_NAME}_BUILD_FORTRAN)
  154. set (${HDF5_PACKAGE_NAME}_INCLUDE_DIR_FORTRAN "${PACKAGE_PREFIX_DIR}/include/static")
  155. endif ()
  156. endif ()
  157. endforeach ()
  158. foreach (libtype IN LISTS ${HDF5_PACKAGE_NAME}_LIB_TYPE)
  159. foreach (comp IN LISTS ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS)
  160. set (hdf5_comp2)
  161. if (comp STREQUAL "C")
  162. set (hdf5_comp "hdf5")
  163. elseif (comp STREQUAL "CXX")
  164. set (hdf5_comp "hdf5_cpp")
  165. elseif (comp STREQUAL "HL")
  166. set (hdf5_comp "hdf5_hl")
  167. elseif (comp STREQUAL "CXX_HL")
  168. set (hdf5_comp "hdf5_hl_cpp")
  169. elseif (comp STREQUAL "Java")
  170. set (hdf5_comp "hdf5_java")
  171. elseif (comp STREQUAL "Tools")
  172. set (hdf5_comp "hdf5_tools")
  173. elseif (comp STREQUAL "Fortran")
  174. set (hdf5_comp2 "hdf5_f90cstub")
  175. set (hdf5_comp "hdf5_fortran")
  176. elseif (comp STREQUAL "Fortran_HL")
  177. set (hdf5_comp2 "hdf5_hl_f90cstub")
  178. set (hdf5_comp "hdf5_hl_fortran")
  179. endif ()
  180. if (comp STREQUAL "Java")
  181. list (FIND ${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES "${hdf5_comp}" HAVE_COMP)
  182. else ()
  183. list (FIND ${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES "${hdf5_comp}-${libtype}" HAVE_COMP)
  184. endif ()
  185. if (${HAVE_COMP} LESS 0)
  186. if (comp STREQUAL "Java")
  187. set (${HDF5_PACKAGE_NAME}_${comp}_FOUND 0)
  188. else ()
  189. set (${HDF5_PACKAGE_NAME}_${libtype}_${comp}_FOUND 0)
  190. endif ()
  191. else ()
  192. if (hdf5_comp2)
  193. list (FIND ${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES "${hdf5_comp2}-${libtype}" HAVE_COMP2)
  194. if (${HAVE_COMP2} LESS 0)
  195. set (${HDF5_PACKAGE_NAME}_${libtype}_${comp}_FOUND 0)
  196. else ()
  197. set (${HDF5_PACKAGE_NAME}_${libtype}_${comp}_FOUND 1)
  198. string(TOUPPER ${HDF5_PACKAGE_NAME}_${comp}_${libtype}_LIBRARY COMP_LIBRARY)
  199. set (${COMP_LIBRARY} ${${COMP_LIBRARY}} ${hdf5_comp2}-${libtype} ${hdf5_comp}-${libtype})
  200. endif ()
  201. elseif (comp STREQUAL "Java")
  202. set (${HDF5_PACKAGE_NAME}_${comp}_FOUND 1)
  203. string(TOUPPER ${HDF5_PACKAGE_NAME}_${comp}_LIBRARY COMP_LIBRARY)
  204. set (${COMP_LIBRARY} ${${COMP_LIBRARY}} ${hdf5_comp})
  205. else ()
  206. set (${HDF5_PACKAGE_NAME}_${libtype}_${comp}_FOUND 1)
  207. string(TOUPPER ${HDF5_PACKAGE_NAME}_${comp}_${libtype}_LIBRARY COMP_LIBRARY)
  208. set (${COMP_LIBRARY} ${${COMP_LIBRARY}} ${hdf5_comp}-${libtype})
  209. endif ()
  210. endif ()
  211. endforeach ()
  212. endforeach ()
  213. foreach (libtype IN LISTS ${HDF5_PACKAGE_NAME}_LIB_TYPE)
  214. check_required_components(${HDF5_PACKAGE_NAME}_${libtype})
  215. endforeach ()