summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt84
-rw-r--r--config/cmake/libhdf5.settings.cmake.in2
-rw-r--r--config/cmake_ext_mod/HDFMacros.cmake84
3 files changed, 88 insertions, 82 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fb1df12..3579f6c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -199,51 +199,6 @@ set (HDF5_JAVA_LOGGING_JAR ${HDF5_SOURCE_DIR}/java/lib/slf4j-api-1.7.5.j
set (HDF5_JAVA_LOGGING_NOP_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-nop-1.7.5.jar)
set (HDF5_JAVA_LOGGING_SIMPLE_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-simple-1.7.5.jar)
-if (APPLE)
- option (HDF5_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE)
-endif ()
-
-if (NOT HDF5_INSTALL_BIN_DIR)
- set (HDF5_INSTALL_BIN_DIR bin)
-endif ()
-if (NOT HDF5_INSTALL_LIB_DIR)
- if (APPLE)
- if (HDF5_BUILD_FRAMEWORKS)
- set (HDF5_INSTALL_JAR_DIR ../Java)
- else ()
- set (HDF5_INSTALL_JAR_DIR lib)
- endif ()
- set (HDF5_INSTALL_FMWK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
- else ()
- set (HDF5_INSTALL_JAR_DIR lib)
- endif ()
- set (HDF5_INSTALL_LIB_DIR lib)
-endif ()
-if (NOT HDF5_INSTALL_INCLUDE_DIR)
- set (HDF5_INSTALL_INCLUDE_DIR include)
-endif ()
-if (NOT HDF5_INSTALL_DATA_DIR)
- if (NOT WIN32)
- if (APPLE)
- if (HDF5_BUILD_FRAMEWORKS)
- set (HDF5_INSTALL_EXTRA_DIR ../SharedSupport)
- else ()
- set (HDF5_INSTALL_EXTRA_DIR share)
- endif ()
- set (HDF5_INSTALL_FWRK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
- endif ()
- set (HDF5_INSTALL_DATA_DIR share)
- set (HDF5_INSTALL_CMAKE_DIR share/cmake)
- else ()
- set (HDF5_INSTALL_DATA_DIR ".")
- set (HDF5_INSTALL_CMAKE_DIR cmake)
- endif ()
-endif ()
-
-if (DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}")
- set (CMAKE_PREFIX_PATH ${ADDITIONAL_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH})
-endif ()
-
#-----------------------------------------------------------------------------
# parse the full version number from H5public.h and include in H5_VERS_INFO
#-----------------------------------------------------------------------------
@@ -406,46 +361,15 @@ set (HDF5_PACKAGE_BUGREPORT "help@hdfgroup.org")
# Include some macros for reusable code
#-----------------------------------------------------------------------------
include (${HDF_RESOURCES_EXT_DIR}/HDFMacros.cmake)
-include (${HDF_RESOURCES_EXT_DIR}/HDFLibMacros.cmake)
-include (${HDF_RESOURCES_DIR}/HDF5Macros.cmake)
-SET_HDF_BUILD_TYPE()
+HDF_DIR_PATHS(${HDF5_PACKAGE_NAME})
-#-----------------------------------------------------------------------------
-# Setup output Directories
-#-----------------------------------------------------------------------------
-if (NOT HDF5_EXTERNALLY_CONFIGURED)
- set (CMAKE_RUNTIME_OUTPUT_DIRECTORY
- ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all Executables."
- )
- set (CMAKE_LIBRARY_OUTPUT_DIRECTORY
- ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all Libraries"
- )
- set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY
- ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all static libraries."
- )
- set (CMAKE_Fortran_MODULE_DIRECTORY
- ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all fortran modules."
- )
- if (WIN32)
- set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTEST_CONFIGURATION_TYPE})
- set (CMAKE_PDB_OUTPUT_DIRECTORY
- ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all pdb files."
- )
- else ()
- set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTEST_CONFIGURATION_TYPE})
- endif ()
-else ()
- # if we are externally configured, but the project uses old cmake scripts
- # this may not be set and utilities like H5detect will fail
- if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
- set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
- endif ()
-endif ()
+include (${HDF_RESOURCES_EXT_DIR}/HDFLibMacros.cmake)
+include (${HDF_RESOURCES_DIR}/HDF5Macros.cmake)
#-----------------------------------------------------------------------------
# Targets built within this project are exported at Install time for use
-# by other projects using FindHDF5.
+# by other projects.
#-----------------------------------------------------------------------------
if (NOT HDF5_EXPORTED_TARGETS)
set (HDF5_EXPORTED_TARGETS "hdf5-targets")
diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in
index 7bb426f..891e3a7 100644
--- a/config/cmake/libhdf5.settings.cmake.in
+++ b/config/cmake/libhdf5.settings.cmake.in
@@ -13,7 +13,7 @@ General Information:
Compiling Options:
------------------
- Build Mode: @HDF_BUILD_TYPE@
+ Build Mode: @CMAKE_BUILD_TYPE@
Debugging Symbols: @SYMBOLS@
Asserts: @ASSERTS@
Profiling: @PROFILING@
diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake
index 1326420..4097ca9 100644
--- a/config/cmake_ext_mod/HDFMacros.cmake
+++ b/config/cmake_ext_mod/HDFMacros.cmake
@@ -166,7 +166,7 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion)
if (${importtype} MATCHES "IMPORT")
set (importprefix "${CMAKE_STATIC_LIBRARY_PREFIX}")
endif ()
- if (${HDF_CFG_NAME} MATCHES "Debug")
+ if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
set (IMPORT_LIB_NAME ${LIB_DEBUG_NAME})
else ()
set (IMPORT_LIB_NAME ${LIB_RELEASE_NAME})
@@ -331,3 +331,85 @@ macro (HDFTEST_COPY_FILE src dest target)
)
list (APPEND ${target}_list "${dest}")
endmacro ()
+
+macro (HDF_DIR_PATHS package_prefix)
+ if (APPLE)
+ option (${package_prefix}_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE)
+ endif ()
+
+ if (NOT ${package_prefix}_INSTALL_BIN_DIR)
+ set (${package_prefix}_INSTALL_BIN_DIR bin)
+ endif ()
+ if (NOT ${package_prefix}_INSTALL_LIB_DIR)
+ if (APPLE)
+ if (${package_prefix}_BUILD_FRAMEWORKS)
+ set (${package_prefix}_INSTALL_JAR_DIR ../Java)
+ else ()
+ set (${package_prefix}_INSTALL_JAR_DIR lib)
+ endif ()
+ set (${package_prefix}_INSTALL_FMWK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
+ else ()
+ set (${package_prefix}_INSTALL_JAR_DIR lib)
+ endif ()
+ set (${package_prefix}_INSTALL_LIB_DIR lib)
+ endif ()
+ if (NOT ${package_prefix}_INSTALL_INCLUDE_DIR)
+ set (${package_prefix}_INSTALL_INCLUDE_DIR include)
+ endif ()
+ if (NOT ${package_prefix}_INSTALL_DATA_DIR)
+ if (NOT WIN32)
+ if (APPLE)
+ if (${package_prefix}_BUILD_FRAMEWORKS)
+ set (${package_prefix}_INSTALL_EXTRA_DIR ../SharedSupport)
+ else ()
+ set (${package_prefix}_INSTALL_EXTRA_DIR share)
+ endif ()
+ set (${package_prefix}_INSTALL_FWRK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
+ endif ()
+ set (${package_prefix}_INSTALL_DATA_DIR share)
+ set (${package_prefix}_INSTALL_CMAKE_DIR share/cmake)
+ else ()
+ set (${package_prefix}_INSTALL_DATA_DIR ".")
+ set (${package_prefix}_INSTALL_CMAKE_DIR cmake)
+ endif ()
+ endif ()
+
+ if (DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}")
+ set (CMAKE_PREFIX_PATH ${ADDITIONAL_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH})
+ endif ()
+
+ SET_HDF_BUILD_TYPE()
+
+#-----------------------------------------------------------------------------
+# Setup output Directories
+#-----------------------------------------------------------------------------
+ if (NOT ${package_prefix}_EXTERNALLY_CONFIGURED)
+ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY
+ ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all Executables."
+ )
+ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY
+ ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all Libraries"
+ )
+ set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY
+ ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all static libraries."
+ )
+ set (CMAKE_Fortran_MODULE_DIRECTORY
+ ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all fortran modules."
+ )
+ if (WIN32)
+ set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTEST_CONFIGURATION_TYPE})
+ set (CMAKE_PDB_OUTPUT_DIRECTORY
+ ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all pdb files."
+ )
+ else ()
+ set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTEST_CONFIGURATION_TYPE})
+ endif ()
+ else ()
+ # if we are externally configured, but the project uses old cmake scripts
+ # this may not be set and utilities like H5detect will fail
+ if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
+ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
+ endif ()
+ endif ()
+endmacro ()
+