summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/cmake/UseJava.cmake8
-rw-r--r--config/cmake_ext_mod/HDFMacros.cmake50
2 files changed, 28 insertions, 30 deletions
diff --git a/config/cmake/UseJava.cmake b/config/cmake/UseJava.cmake
index 60b1758..10ffe47 100644
--- a/config/cmake/UseJava.cmake
+++ b/config/cmake/UseJava.cmake
@@ -794,9 +794,11 @@ function(add_jar _TARGET_NAME)
if (_GENERATE_NATIVE_HEADERS)
# create an INTERFACE library encapsulating include directory for generated headers
add_library (${_GENERATE_NATIVE_HEADERS_TARGET} INTERFACE)
- target_include_directories (${_GENERATE_NATIVE_HEADERS_TARGET} INTERFACE
- "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}"
- ${JNI_INCLUDE_DIRS})
+ target_include_directories (${_GENERATE_NATIVE_HEADERS_TARGET}
+ INTERFACE
+ "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}"
+ ${JNI_INCLUDE_DIRS}
+ )
# this INTERFACE library depends on jar generation
add_dependencies (${_GENERATE_NATIVE_HEADERS_TARGET} ${_TARGET_NAME})
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 ()
#-----------------------------------------------------------------------------