diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2018-04-26 21:41:04 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2018-04-26 21:41:04 (GMT) |
commit | 2347bffaa2d48b62a22575fbc93b1f5c2716d8d4 (patch) | |
tree | 963395e7cd4bd66761194c8cee840906b16abb3a /config/cmake_ext_mod | |
parent | bc9a773b994cde788e97e5e998eb5fcd21ec8a39 (diff) | |
download | hdf5-2347bffaa2d48b62a22575fbc93b1f5c2716d8d4.zip hdf5-2347bffaa2d48b62a22575fbc93b1f5c2716d8d4.tar.gz hdf5-2347bffaa2d48b62a22575fbc93b1f5c2716d8d4.tar.bz2 |
TRILABS-19 remove add_defintions and use generator expressions
Diffstat (limited to 'config/cmake_ext_mod')
-rw-r--r-- | config/cmake_ext_mod/HDFMacros.cmake | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 04d60e1..66e581d 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -219,37 +219,33 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) endmacro () #------------------------------------------------------------------------------- -macro (TARGET_C_PROPERTIES wintarget libtype addcompileflags addlinkflags) - if (MSVC) - TARGET_MSVC_PROPERTIES (${wintarget} ${libtype} "${addcompileflags} ${WIN_COMPILE_FLAGS}" "${addlinkflags} ${WIN_LINK_FLAGS}") - else () - set_target_properties (${wintarget} PROPERTIES COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "${addlinkflags}") - endif () -endmacro () - -#------------------------------------------------------------------------------- -macro (TARGET_MSVC_PROPERTIES wintarget libtype addcompileflags addlinkflags) - if (MSVC) - set_target_properties (${wintarget} PROPERTIES COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "${addlinkflags}") - endif () -endmacro () - -#------------------------------------------------------------------------------- -macro (TARGET_FORTRAN_PROPERTIES forttarget libtype addcompileflags addlinkflags) - if (WIN32) - TARGET_FORTRAN_WIN_PROPERTIES (${forttarget} ${libtype} "${addcompileflags} ${WIN_COMPILE_FLAGS}" "${addlinkflags} ${WIN_LINK_FLAGS}") - endif () +macro (TARGET_C_PROPERTIES wintarget libtype) + target_compile_options(${wintarget} PRIVATE + $<$<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}> + ) endmacro () #------------------------------------------------------------------------------- -macro (TARGET_FORTRAN_WIN_PROPERTIES forttarget libtype addcompileflags addlinkflags) - if (MSVC) - if (${libtype} MATCHES "SHARED") - set_target_properties (${forttarget} PROPERTIES COMPILE_FLAGS "/dll ${addcompileflags}" LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}") - else () - set_target_properties (${forttarget} PROPERTIES COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}") - endif () +macro (TARGET_FORTRAN_PROPERTIES forttarget libtype) + if (${libtype} MATCHES "SHARED") + target_compile_options(${forttarget} PRIVATE + $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/dll"> + $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> + ) + else () + target_compile_options(${forttarget} PRIVATE + $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> + ) endif () + target_link_libraries(${forttarget} INTERFACE + $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE"> + $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> + ) endmacro () #----------------------------------------------------------------------------- |