summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2018-01-08 22:04:46 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2018-01-08 22:04:46 (GMT)
commit49479589d342324b564003738f2d259ae40b5aca (patch)
treefce13c862a5c1b0a808d6b2c18532e8aea71c611 /config
parentca327ba1c42c1cab1b0b38bde76a1baaec73407f (diff)
downloadhdf5-49479589d342324b564003738f2d259ae40b5aca.zip
hdf5-49479589d342324b564003738f2d259ae40b5aca.tar.gz
hdf5-49479589d342324b564003738f2d259ae40b5aca.tar.bz2
HDFFV-10385 Refactor use of CMAKE_BUILD_TYPE
Diffstat (limited to 'config')
-rw-r--r--config/cmake/HDFCompilerFlags.cmake6
-rw-r--r--config/cmake/libhdf5.settings.cmake.in6
-rw-r--r--config/cmake_ext_mod/HDFMacros.cmake39
3 files changed, 41 insertions, 10 deletions
diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake
index 5f71f33..eeb4b97 100644
--- a/config/cmake/HDFCompilerFlags.cmake
+++ b/config/cmake/HDFCompilerFlags.cmake
@@ -13,12 +13,12 @@
# Compiler specific flags : Shouldn't there be compiler tests for these
#-----------------------------------------------------------------------------
if (CMAKE_COMPILER_IS_GNUCC)
- if (CMAKE_BUILD_TYPE MATCHES Debug)
+ if (HDF5_BUILD_TYPE MATCHES Debug)
set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99")
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -ftrapv -fno-common")
endif ()
- else (CMAKE_BUILD_TYPE MATCHES Debug)
+ else (HDF5_BUILD_TYPE MATCHES Debug)
set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS} -std=c99")
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstdarg-opt")
@@ -26,7 +26,7 @@ if (CMAKE_COMPILER_IS_GNUCC)
endif ()
endif ()
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- if (CMAKE_BUILD_TYPE MATCHES Debug)
+ if (HDF5_BUILD_TYPE MATCHES Debug)
set (CMAKE_CXX_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_CXX_FLAGS}")
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Og -ftrapv -fno-common")
diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in
index 8348af0..28fb876 100644
--- a/config/cmake/libhdf5.settings.cmake.in
+++ b/config/cmake/libhdf5.settings.cmake.in
@@ -1,5 +1,5 @@
- SUMMARY OF THE HDF5 CONFIGURATION
- =================================
+ SUMMARY OF THE HDF5 CONFIGURATION
+ =================================
General Information:
-------------------
@@ -13,7 +13,7 @@ General Information:
Compiling Options:
------------------
- Build Mode: @CMAKE_BUILD_TYPE@
+ Build Mode: @HDF5_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 192a5c8..dd7e262 100644
--- a/config/cmake_ext_mod/HDFMacros.cmake
+++ b/config/cmake_ext_mod/HDFMacros.cmake
@@ -9,6 +9,37 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
+
+#-------------------------------------------------------------------------------
+macro (SET_HDF5_BUILD_TYPE)
+ get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+ if(_isMultiConfig)
+ set(HDF5_BUILD_TYPE ${CMAKE_CFG_INTDIR})
+ else()
+ if(CMAKE_BUILD_TYPE)
+ set(HDF5_BUILD_TYPE ${CMAKE_BUILD_TYPE})
+ else()
+ set(HDF5_BUILD_TYPE)
+ endif()
+ endif()
+endmacro ()
+
+#-------------------------------------------------------------------------------
+macro (CREATE_CONFIG_DIR path)
+ get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+ if(_isMultiConfig)
+ foreach(c ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})
+ file(MAKE_DIRECTORY "${path}/${c}")
+ endforeach()
+ else()
+ if(CMAKE_BUILD_TYPE)
+ file(MAKE_DIRECTORY "${path}/${CMAKE_BUILD_TYPE}")
+ else()
+ file(MAKE_DIRECTORY "${path}")
+ endif()
+ endif()
+endmacro ()
+
#-------------------------------------------------------------------------------
macro (SET_GLOBAL_VARIABLE name value)
set (${name} ${value} CACHE INTERNAL "Used to pass variables between directories" FORCE)
@@ -145,7 +176,7 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion)
if (${importtype} MATCHES "IMPORT")
set (importprefix "${CMAKE_STATIC_LIBRARY_PREFIX}")
endif ()
- if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
+ if (${HDF5_BUILD_TYPE} MATCHES "Debug")
set (IMPORT_LIB_NAME ${LIB_DEBUG_NAME})
else ()
set (IMPORT_LIB_NAME ${LIB_RELEASE_NAME})
@@ -160,8 +191,8 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion)
)
else ()
set_target_properties (${libtarget} PROPERTIES
- IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}"
- IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"
+ IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF5_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}"
+ IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF5_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}"
)
endif ()
else ()
@@ -181,7 +212,7 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion)
else ()
if (WIN32 AND NOT MINGW)
set_target_properties (${libtarget} PROPERTIES
- IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}/${IMPORT_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}"
+ IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF5_BUILD_TYPE}/${IMPORT_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
)
else ()