diff options
author | Allen Byrne <50328838+byrnHDF@users.noreply.github.com> | 2023-05-02 19:54:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-02 19:54:17 (GMT) |
commit | 94a3d86fb867182f90e60f7955c3653b3ac53b8e (patch) | |
tree | 13e5dbf7d1b60f28d752cfe2ceb133348629bdc2 /config | |
parent | 6bd9f780620bc221b9a9521eca736e1a762844d0 (diff) | |
download | hdf5-94a3d86fb867182f90e60f7955c3653b3ac53b8e.zip hdf5-94a3d86fb867182f90e60f7955c3653b3ac53b8e.tar.gz hdf5-94a3d86fb867182f90e60f7955c3653b3ac53b8e.tar.bz2 |
Correct usage of CMAKE_BUILD_TYPE (#2868)
Diffstat (limited to 'config')
-rw-r--r-- | config/cmake/libhdf5.settings.cmake.in | 2 | ||||
-rw-r--r-- | config/cmake_ext_mod/HDFLibMacros.cmake | 8 | ||||
-rw-r--r-- | config/cmake_ext_mod/HDFMacros.cmake | 33 |
3 files changed, 20 insertions, 23 deletions
diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index d80b0f8..0e2c013 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: @CMAKE_BUILD_TYPE@ + Build Mode: @HDF_CFG_NAME@ Debugging Symbols: @HDF5_ENABLE_SYMBOLS@ Asserts: @HDF5_ENABLE_ASSERTS@ Profiling: @HDF5_ENABLE_PROFILING@ diff --git a/config/cmake_ext_mod/HDFLibMacros.cmake b/config/cmake_ext_mod/HDFLibMacros.cmake index d2f2660..6d77ab5 100644 --- a/config/cmake_ext_mod/HDFLibMacros.cmake +++ b/config/cmake_ext_mod/HDFLibMacros.cmake @@ -89,7 +89,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DBUILD_SHARED_LIBS:BOOL=OFF -DSZIP_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} -DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DCMAKE_BUILD_TYPE:STRING=${HDF_CFG_NAME} -DCMAKE_DEBUG_POSTFIX:STRING=${CMAKE_DEBUG_POSTFIX} -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} @@ -111,7 +111,7 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding) -DBUILD_SHARED_LIBS:BOOL=OFF -DSZIP_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} -DSZIP_EXTERNALLY_CONFIGURED:BOOL=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DCMAKE_BUILD_TYPE:STRING=${HDF_CFG_NAME} -DCMAKE_DEBUG_POSTFIX:STRING=${CMAKE_DEBUG_POSTFIX} -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} @@ -184,7 +184,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) -DBUILD_SHARED_LIBS:BOOL=OFF -DZLIB_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} -DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DCMAKE_BUILD_TYPE:STRING=${HDF_CFG_NAME} -DCMAKE_DEBUG_POSTFIX:STRING=${CMAKE_DEBUG_POSTFIX} -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} @@ -205,7 +205,7 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type) -DBUILD_SHARED_LIBS:BOOL=OFF -DZLIB_PACKAGE_EXT:STRING=${HDF_PACKAGE_EXT} -DZLIB_EXTERNALLY_CONFIGURED:BOOL=OFF - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DCMAKE_BUILD_TYPE:STRING=${HDF_CFG_NAME} -DCMAKE_DEBUG_POSTFIX:STRING=${CMAKE_DEBUG_POSTFIX} -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 7483f3c..b369ab1 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -14,28 +14,23 @@ macro (SET_HDF_BUILD_TYPE) get_property (_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if (_isMultiConfig) - set (HDF_CFG_NAME ${CMAKE_BUILD_TYPE}) - set (HDF_BUILD_TYPE ${CMAKE_CFG_INTDIR}) + # HDF_CFG_BUILD_TYPE is used in the Fortran install commands for the build location of the .mod files set (HDF_CFG_BUILD_TYPE \${CMAKE_INSTALL_CONFIG_NAME}) + if (CMAKE_BUILD_TYPE) + # set the default to the specified command line define + set (HDF_CFG_NAME ${CMAKE_BUILD_TYPE}) + else () + # set the default to the MultiConfig variable + set (HDF_CFG_NAME ${CMAKE_CFG_INTDIR}) + endif () else () set (HDF_CFG_BUILD_TYPE ".") if (CMAKE_BUILD_TYPE) set (HDF_CFG_NAME ${CMAKE_BUILD_TYPE}) - set (HDF_BUILD_TYPE ${CMAKE_BUILD_TYPE}) else () set (HDF_CFG_NAME "Release") - set (HDF_BUILD_TYPE "Release") endif () endif () - if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Setting build type to 'RelWithDebInfo' as none was specified.") - endif() - set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) - # Set the possible values of build type for cmake-gui - set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" - "MinSizeRel" "RelWithDebInfo") - endif () endmacro () #------------------------------------------------------------------------------- @@ -75,9 +70,11 @@ endmacro () #------------------------------------------------------------------------------- macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent) + option (DISABLE_PDB_FILES "Do not install PDB files" OFF) + mark_as_advanced (DISABLE_PDB_FILES) if (WIN32 AND MSVC AND NOT DISABLE_PDB_FILES) get_target_property (target_type ${libtarget} TYPE) - if (${libtype} MATCHES "SHARED") + if (${target_type} MATCHES "SHARED") set (targetfilename $<TARGET_PDB_FILE:${libtarget}>) else () get_property (target_name TARGET ${libtarget} PROPERTY $<IF:$<CONFIG:Debug>,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) @@ -173,8 +170,8 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) ) else () set_target_properties (${libtarget} PROPERTIES - IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" - IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF_BUILD_TYPE}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" + IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF_CFG_NAME}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF_CFG_NAME}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" ) endif () else () @@ -199,7 +196,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}/${HDF_BUILD_TYPE}/${IMPORT_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${HDF_CFG_NAME}/${IMPORT_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) else () @@ -453,7 +450,7 @@ macro (HDF_DIR_PATHS package_prefix) ) get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(_isMultiConfig) - set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}) + set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${HDF_CFG_NAME}) set (CMAKE_PDB_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all pdb files." ) |