diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2019-07-27 17:50:58 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2019-07-27 17:50:58 (GMT) |
commit | 3333acc05a6b3be7ed93c1291b7d4c69ed262f72 (patch) | |
tree | 7e618cad0faa94057b00a9a6d5b54d2d8e0dfe25 /config/cmake_ext_mod/HDFMacros.cmake | |
parent | 3a6b7da5f338388d83036ec7f9c3d64c01ff8ed1 (diff) | |
download | hdf5-3333acc05a6b3be7ed93c1291b7d4c69ed262f72.zip hdf5-3333acc05a6b3be7ed93c1291b7d4c69ed262f72.tar.gz hdf5-3333acc05a6b3be7ed93c1291b7d4c69ed262f72.tar.bz2 |
Merge of HDFFV-10845, 10529 from develop
Diffstat (limited to 'config/cmake_ext_mod/HDFMacros.cmake')
-rw-r--r-- | config/cmake_ext_mod/HDFMacros.cmake | 65 |
1 files changed, 41 insertions, 24 deletions
diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 2f4ce52..e320c07 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -28,7 +28,7 @@ macro (SET_HDF_BUILD_TYPE) endif() endif() if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.") + message (STATUS "Setting build type to 'RelWithDebInfo' as none was specified.") 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" @@ -73,12 +73,12 @@ endmacro () #------------------------------------------------------------------------------- macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent) - if (WIN32 AND MSVC) + if (WIN32 AND MSVC AND NOT DISABLE_PDB_FILES) get_target_property (target_type ${libtarget} TYPE) if (${libtype} MATCHES "SHARED") set (targetfilename $<TARGET_PDB_FILE:${libtarget}>) else () - get_property (target_name TARGET ${libtarget} PROPERTY OUTPUT_NAME_RELWITHDEBINFO) + get_property (target_name TARGET ${libtarget} PROPERTY $<IF:$<CONFIG:Debug>,OUTPUT_NAME_DEBUG,OUTPUT_NAME_RELWITHDEBINFO>) set (targetfilename $<TARGET_FILE_DIR:${libtarget}>/${target_name}.pdb) endif () install ( @@ -86,9 +86,10 @@ macro (INSTALL_TARGET_PDB libtarget targetdestination targetcomponent) ${targetfilename} DESTINATION ${targetdestination} - CONFIGURATIONS RelWithDebInfo + CONFIGURATIONS Debug RelWithDebInfo COMPONENT ${targetcomponent} - ) + OPTIONAL + ) endif () endmacro () @@ -100,29 +101,25 @@ macro (INSTALL_PROGRAM_PDB progtarget targetdestination targetcomponent) $<TARGET_PDB_FILE:${progtarget}> DESTINATION ${targetdestination} - CONFIGURATIONS RelWithDebInfo + CONFIGURATIONS Debug RelWithDebInfo COMPONENT ${targetcomponent} - ) + OPTIONAL + ) endif () endmacro () #------------------------------------------------------------------------------- macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) - if (WIN32) - set (LIB_DEBUG_SUFFIX "_D") - else () - set (LIB_DEBUG_SUFFIX "_debug") - endif () if (${libtype} MATCHES "SHARED") set (LIB_RELEASE_NAME "${libname}") - set (LIB_DEBUG_NAME "${libname}${LIB_DEBUG_SUFFIX}") + set (LIB_DEBUG_NAME "${libname}${CMAKE_DEBUG_POSTFIX}") else () - if (WIN32) + if (WIN32 AND NOT MINGW) set (LIB_RELEASE_NAME "lib${libname}") - set (LIB_DEBUG_NAME "lib${libname}${LIB_DEBUG_SUFFIX}") + set (LIB_DEBUG_NAME "lib${libname}${CMAKE_DEBUG_POSTFIX}") else () set (LIB_RELEASE_NAME "${libname}") - set (LIB_DEBUG_NAME "${libname}${LIB_DEBUG_SUFFIX}") + set (LIB_DEBUG_NAME "${libname}${CMAKE_DEBUG_POSTFIX}") endif () endif () @@ -130,8 +127,8 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) PROPERTIES OUTPUT_NAME ${LIB_RELEASE_NAME} - OUTPUT_NAME_DEBUG - ${LIB_DEBUG_NAME} +# OUTPUT_NAME_DEBUG +# ${LIB_DEBUG_NAME} OUTPUT_NAME_RELEASE ${LIB_RELEASE_NAME} OUTPUT_NAME_MINSIZEREL @@ -139,6 +136,11 @@ macro (HDF_SET_LIB_OPTIONS libtarget libname libtype) OUTPUT_NAME_RELWITHDEBINFO ${LIB_RELEASE_NAME} ) + #get_property (target_name TARGET ${libtarget} PROPERTY OUTPUT_NAME) + #get_property (target_name_debug TARGET ${libtarget} PROPERTY OUTPUT_NAME_DEBUG) + #get_property (target_name_rwdi TARGET ${libtarget} PROPERTY OUTPUT_NAME_RELWITHDEBINFO) + #message (STATUS "${target_name} : ${target_name_debug} : ${target_name_rwdi}") + if (${libtype} MATCHES "STATIC") if (WIN32) set_target_properties (${libtarget} @@ -190,7 +192,12 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) ) endif () else () - if (CYGWIN) + if (MINGW) + set_target_properties (${libtarget} PROPERTIES + IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${IMPORT_LIB_NAME}.lib" + IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" + ) + elseif (CYGWIN) set_target_properties (${libtarget} PROPERTIES IMPORTED_IMPLIB "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" IMPORTED_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_IMPORT_LIBRARY_PREFIX}${IMPORT_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" @@ -224,10 +231,9 @@ macro (TARGET_C_PROPERTIES wintarget libtype) $<$<C_COMPILER_ID:MSVC>:${WIN_COMPILE_FLAGS}> $<$<CXX_COMPILER_ID:MSVC>:${WIN_COMPILE_FLAGS}> ) - target_link_libraries(${wintarget} INTERFACE - $<$<C_COMPILER_ID:MSVC>:${WIN_LINK_FLAGS}> - $<$<CXX_COMPILER_ID:MSVC>:${WIN_LINK_FLAGS}> - ) + if(MSVC) + set_property(TARGET ${wintarget} APPEND PROPERTY LINK_FLAGS "${WIN_LINK_FLAGS}") + endif() endmacro () #----------------------------------------------------------------------------- @@ -294,7 +300,9 @@ macro (HDF_README_PROPERTIES target_fortran) set (BINARY_PLATFORM "${BINARY_PLATFORM} / ${CMAKE_Fortran_COMPILER_ID} Fortran") endif () - if (BUILD_SHARED_LIBS) + if (ONLY_SHARED_LIBS) + set (LIB_TYPE "Shared") + elseif (BUILD_SHARED_LIBS) set (LIB_TYPE "Static and Shared") else () set (LIB_TYPE "Static") @@ -377,6 +385,15 @@ macro (HDF_DIR_PATHS package_prefix) set (CMAKE_PREFIX_PATH ${ADDITIONAL_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH}) endif () + #set the default debug suffix for all library targets + if(NOT CMAKE_DEBUG_POSTFIX) + if (WIN32) + set (CMAKE_DEBUG_POSTFIX "_D") + else () + set (CMAKE_DEBUG_POSTFIX "_debug") + endif () + endif () + SET_HDF_BUILD_TYPE() #----------------------------------------------------------------------------- |