diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2010-08-20 15:37:50 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2010-08-20 15:37:50 (GMT) |
commit | 88ebaa5e4726643ad472d8fc8f731ede87b44b11 (patch) | |
tree | 9dda1e6f8a1183e599934393a7f3d38ba1517bce /CMakeLists.txt | |
parent | d71fcfff2cfdc01c1dcf388cc080b7ca9e36bd68 (diff) | |
download | hdf5-88ebaa5e4726643ad472d8fc8f731ede87b44b11.zip hdf5-88ebaa5e4726643ad472d8fc8f731ede87b44b11.tar.gz hdf5-88ebaa5e4726643ad472d8fc8f731ede87b44b11.tar.bz2 |
[svn-r19260] Change Cmake to allow a local zlib header to be used in H5Zdelate module.
Corrected use of "SKIP" message in cmake.
Corrections to cmake configuration files (for cmake external projects).
Community suggested changes.
Tested: local linux
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 137 |
1 files changed, 89 insertions, 48 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 118b617..15259d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,12 @@ PROJECT (HDF5 C CXX) # name conflicts with system versions, then a prefix may be added # to ensure that the correct versions configured are used. # +# HDF5_INSTALL_BIN_DIR, HDF5_INSTALL_LIB_DIR, HDF5_INSTALL_INCLUDE_DIR : +# Customize the 'bin', 'lib', and 'include' installation directories. +# +# HDF5_INSTALL_NO_DEVELOPMENT : +# Set to true to skip installation of headers and CMake package files. +# # Consider this example from the ParaView project, it builds its own zlib # library and tells HDF5 to add it as a dependency - this ensures that # any project making use of this build of HDF5 will use the correct zlib @@ -128,6 +134,16 @@ SET (HDF5_F90_SOURCE_DIR ${HDF5_SOURCE_DIR}/fortran) # set default prefix location SET (CMAKE_INSTALL_PREFIX "./hdf5" CACHE PATH "Install path prefix, prepended onto install directories") +IF (NOT HDF5_INSTALL_BIN_DIR) + SET (HDF5_INSTALL_BIN_DIR bin) +ENDIF (NOT HDF5_INSTALL_BIN_DIR) +IF (NOT HDF5_INSTALL_LIB_DIR) + SET (HDF5_INSTALL_LIB_DIR lib) +ENDIF (NOT HDF5_INSTALL_LIB_DIR) +IF (NOT HDF5_INSTALL_INCLUDE_DIR) + SET (HDF5_INSTALL_INCLUDE_DIR include) +ENDIF (NOT HDF5_INSTALL_INCLUDE_DIR) + #----------------------------------------------------------------------------- # parse the full version number from H5public.h and include in H5_VERS_INFO #----------------------------------------------------------------------------- @@ -180,7 +196,7 @@ ELSE (NOT HDF5_EXTERNALLY_CONFIGURED) IF (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) ENDIF (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) -ENDIF(NOT HDF5_EXTERNALLY_CONFIGURED) +ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) #----------------------------------------------------------------------------- # Targets built within this project are exported at Install time for use @@ -493,11 +509,11 @@ IF (BUILD_TESTING) ENABLE_TESTING () INCLUDE (CTest) IF (NOT HDF5_EXTERNALLY_CONFIGURED) - IF(EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test") + IF (EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test") ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/tools/lib ${PROJECT_BINARY_DIR}/tools/lib) ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/test ${PROJECT_BINARY_DIR}/test) - ENDIF(EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test") - IF(EXISTS "${HDF5_SOURCE_DIR}/perform" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/perform") + ENDIF (EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test") + IF (EXISTS "${HDF5_SOURCE_DIR}/perform" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/perform") ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/perform ${PROJECT_BINARY_DIR}/perform) ENDIF(EXISTS "${HDF5_SOURCE_DIR}/perform" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/perform") ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) @@ -512,59 +528,59 @@ ENDIF (BUILD_TESTING) # Set default name mangling : overridden by Fortran detection in fortran dir SET (H5_FC_FUNC "H5_FC_FUNC(name,NAME) name ## _") SET (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) name ## _") -IF(EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran") +IF (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran") OPTION (HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF) IF (HDF5_BUILD_FORTRAN) ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/fortran ${PROJECT_BINARY_DIR}/fortran) IF (HDF5_BUILD_HL_LIB) - IF(EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran") + IF (EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran") #-- Build the High Level Fortran source codes ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/hl/fortran ${HDF5_BINARY_DIR}/hl/fortran) - ENDIF(EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran") + ENDIF (EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran") ENDIF (HDF5_BUILD_HL_LIB) ENDIF (HDF5_BUILD_FORTRAN) -ENDIF(EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran") +ENDIF (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran") #----------------------------------------------------------------------------- # Option to build examples #----------------------------------------------------------------------------- -IF(EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples") +IF (EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples") OPTION (HDF5_BUILD_EXAMPLES "Build HDF5 Library Examples" OFF) IF (HDF5_BUILD_EXAMPLES) ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/examples ${PROJECT_BINARY_DIR}/examples) ENDIF (HDF5_BUILD_EXAMPLES) -ENDIF(EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples") +ENDIF (EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples") #----------------------------------------------------------------------------- # Option to build HDF5 C++ Library #----------------------------------------------------------------------------- -IF(EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") +IF (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") OPTION (HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" OFF) IF (HDF5_BUILD_CPP_LIB) ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/c++ ${PROJECT_BINARY_DIR}/c++) ENDIF (HDF5_BUILD_CPP_LIB) -ENDIF(EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") +ENDIF (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") #----------------------------------------------------------------------------- # Option to build HDF5 Tools #----------------------------------------------------------------------------- -IF(EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools") +IF (EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools") OPTION (HDF5_BUILD_TOOLS "Build HDF5 Tools" OFF) IF (HDF5_BUILD_TOOLS) ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/tools ${PROJECT_BINARY_DIR}/tools) ENDIF (HDF5_BUILD_TOOLS) -ENDIF(EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools") +ENDIF (EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools") #----------------------------------------------------------------------------- # Option to build High Level API's #----------------------------------------------------------------------------- -IF(EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl") +IF (EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl") OPTION (HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" OFF) IF (HDF5_BUILD_HL_LIB) SET (H5_INCLUDE_HL 1) ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/hl ${PROJECT_BINARY_DIR}/hl) ENDIF (HDF5_BUILD_HL_LIB) -ENDIF(EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl") +ENDIF (EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl") #----------------------------------------------------------------------------- # Generate the H5pubconf.h file containing user settings needed by compilation @@ -574,36 +590,43 @@ CONFIGURE_FILE (${HDF5_RESOURCES_DIR}/H5pubconf.h.in ${HDF5_BINARY_DIR}/H5pubcon #----------------------------------------------------------------------------- # Add file(s) to CMake Install #----------------------------------------------------------------------------- -INSTALL ( - FILES - ${PROJECT_BINARY_DIR}/H5pubconf.h - DESTINATION - include - COMPONENT - headers -) +IF (NOT HDF5_INSTALL_NO_DEVELOPMENT) + INSTALL ( + FILES + ${PROJECT_BINARY_DIR}/H5pubconf.h + DESTINATION + ${HDF5_INSTALL_INCLUDE_DIR} + COMPONENT + headers + ) +ENDIF (NOT HDF5_INSTALL_NO_DEVELOPMENT) #----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects #----------------------------------------------------------------------------- -INSTALL ( - EXPORT - ${HDF5_EXPORTED_TARGETS} - DESTINATION - lib/cmake/hdf5-${HDF5_PACKAGE_VERSION} - FILE - hdf5-targets.cmake -) +IF (NOT HDF5_EXTERNALLY_CONFIGURED) + INSTALL ( + EXPORT + ${HDF5_EXPORTED_TARGETS} + DESTINATION + lib/cmake/hdf5-${HDF5_PACKAGE_VERSION} + FILE + hdf5-targets.cmake + ) +ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) #----------------------------------------------------------------------------- # Export all exported targets to the build tree for use by parent project #----------------------------------------------------------------------------- -EXPORT ( - TARGETS - ${HDF5_LIBRARIES_TO_EXPORT} ${HDF5_LIB_DEPENDENCIES} - FILE - hdf5-targets.cmake -) +IF (NOT HDF5_EXTERNALLY_CONFIGURED) + EXPORT ( + TARGETS + ${HDF5_LIBRARIES_TO_EXPORT} ${HDF5_LIB_DEPENDENCIES} + FILE + hdf5-targets.cmake + ) +ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) + #----------------------------------------------------------------------------- # Configure the hdf5-config.cmake file for the build directory #----------------------------------------------------------------------------- @@ -623,16 +646,34 @@ CONFIGURE_FILE ( #----------------------------------------------------------------------------- # Configure the hdf5-config.cmake file for the install directory #----------------------------------------------------------------------------- -CONFIGURE_FILE ( - ${HDF5_RESOURCES_DIR}/hdf5-config.cmake.install.in - ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config.cmake @ONLY -) -INSTALL ( - FILES - ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config.cmake - DESTINATION - lib/cmake/hdf5-${HDF5_PACKAGE_VERSION} -) +IF (NOT HDF5_EXTERNALLY_CONFIGURED) + CONFIGURE_FILE ( + ${HDF5_RESOURCES_DIR}/hdf5-config.cmake.install.in + ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config.cmake @ONLY + ) + INSTALL ( + FILES + ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config.cmake + DESTINATION + lib/cmake/hdf5-${HDF5_PACKAGE_VERSION} + ) +ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) + +#----------------------------------------------------------------------------- +# Configure the hdf5-config-version .cmake file for the install directory +#----------------------------------------------------------------------------- +IF (NOT HDF5_EXTERNALLY_CONFIGURED) + CONFIGURE_FILE ( + ${HDF5_RESOURCES_DIR}/hdf5-config-version.cmake.in + ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config-version.cmake @ONLY + ) + INSTALL ( + FILES + ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config-version.cmake + DESTINATION + lib/cmake/hdf5-${HDF5_PACKAGE_VERSION} + ) +ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) #----------------------------------------------------------------------------- # Set the cpack variables |