summaryrefslogtreecommitdiffstats
path: root/fortran/test
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2018-04-26 21:41:04 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2018-04-26 21:41:04 (GMT)
commit2347bffaa2d48b62a22575fbc93b1f5c2716d8d4 (patch)
tree963395e7cd4bd66761194c8cee840906b16abb3a /fortran/test
parentbc9a773b994cde788e97e5e998eb5fcd21ec8a39 (diff)
downloadhdf5-2347bffaa2d48b62a22575fbc93b1f5c2716d8d4.zip
hdf5-2347bffaa2d48b62a22575fbc93b1f5c2716d8d4.tar.gz
hdf5-2347bffaa2d48b62a22575fbc93b1f5c2716d8d4.tar.bz2
TRILABS-19 remove add_defintions and use generator expressions
Diffstat (limited to 'fortran/test')
-rw-r--r--fortran/test/CMakeLists.txt190
1 files changed, 77 insertions, 113 deletions
diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt
index 7f538f1..1fb26f5 100644
--- a/fortran/test/CMakeLists.txt
+++ b/fortran/test/CMakeLists.txt
@@ -12,15 +12,9 @@ add_executable (H5_test_buildiface
target_include_directories(H5_test_buildiface PRIVATE ${HDF5_BINARY_DIR} ${HDF5_F90_BINARY_DIR})
if (WIN32 AND MSVC)
if (BUILD_SHARED_LIBS)
- set_target_properties (H5_test_buildiface
- PROPERTIES
- COMPILE_FLAGS "/MT"
- )
+ set_target_properties (H5_test_buildiface PROPERTIES COMPILE_FLAGS "/MT")
endif ()
- set_target_properties (H5_test_buildiface
- PROPERTIES
- LINK_FLAGS "/SUBSYSTEM:CONSOLE"
- )
+ set_target_properties (H5_test_buildiface PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE")
endif ()
set_target_properties (H5_test_buildiface PROPERTIES
LINKER_LANGUAGE Fortran
@@ -39,9 +33,12 @@ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE
#-----------------------------------------------------------------------------
add_library (${HDF5_F90_C_TEST_LIB_TARGET} STATIC t.c)
set_source_files_properties (t.c PROPERTIES LANGUAGE C)
-set_property(TARGET ${HDF5_F90_C_TEST_LIB_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static")
-TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} STATIC " " " ")
-target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET}
+target_include_directories(${HDF5_F90_C_TEST_LIB_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+)
+TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} STATIC)
+target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} PRIVATE
${HDF5_F90_C_LIB_TARGET}
${HDF5_TEST_LIB_TARGET}
)
@@ -49,13 +46,18 @@ H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} ST
set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES
FOLDER libraries/test/fortran
LINKER_LANGUAGE C
- INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
if (BUILD_SHARED_LIBS)
add_library (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED t.c)
- set_property(TARGET ${HDF5_F90_C_TEST_LIBSH_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared")
- TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED " " " ")
- target_link_libraries (${HDF5_F90_C_TEST_LIBSH_TARGET}
+ target_include_directories(${HDF5_F90_C_TEST_LIBSH_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ target_compile_definitions(${HDF5_F90_C_TEST_LIBSH_TARGET}
+ PUBLIC "H5_BUILT_AS_DYNAMIC_LIB"
+ )
+ TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED)
+ target_link_libraries (${HDF5_F90_C_TEST_LIBSH_TARGET} PRIVATE
${HDF5_F90_C_LIBSH_TARGET}
${HDF5_TEST_LIBSH_TARGET}
)
@@ -63,9 +65,6 @@ if (BUILD_SHARED_LIBS)
set_target_properties (${HDF5_F90_C_TEST_LIBSH_TARGET} PROPERTIES
FOLDER libraries/test/fortran
LINKER_LANGUAGE C
- COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB"
- INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
- INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1
)
endif ()
@@ -115,56 +114,48 @@ if (BUILD_SHARED_LIBS)
endif ()
add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC ${HDF5_F90_TF_SOURCES})
-TARGET_FORTRAN_PROPERTIES (${HDF5_F90_TEST_LIB_TARGET} STATIC " " " ")
-target_link_libraries (${HDF5_F90_TEST_LIB_TARGET}
+target_include_directories (${HDF5_F90_TEST_LIB_TARGET}
+ PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+)
+target_compile_definitions(${HDF5_F90_TEST_LIB_TARGET}
+ PRIVATE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"HDF5F90_WINDOWS">
+)
+TARGET_FORTRAN_PROPERTIES (${HDF5_F90_TEST_LIB_TARGET} STATIC)
+target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} PUBLIC
${HDF5_F90_C_TEST_LIB_TARGET}
${HDF5_F90_LIB_TARGET}
${HDF5_LIB_TARGET}
)
H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} STATIC 0)
-target_include_directories (${HDF5_F90_TEST_LIB_TARGET} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
-set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared")
set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES
FOLDER libraries/test/fortran
LINKER_LANGUAGE Fortran
- INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
)
-if (WIN32)
- set_property (TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY
- COMPILE_DEFINITIONS "HDF5F90_WINDOWS"
- )
-endif ()
add_dependencies(${HDF5_F90_TEST_LIB_TARGET} H5testgen)
if (BUILD_SHARED_LIBS)
add_library (${HDF5_F90_TEST_LIBSH_TARGET} SHARED ${HDF5_F90_TF_SOURCES_SHARED})
- set (SHARED_LINK_FLAGS " ")
- if (WIN32 AND MSVC)
- set (SHARED_LINK_FLAGS "/DLL")
- endif ()
- TARGET_FORTRAN_PROPERTIES (${HDF5_F90_TEST_LIBSH_TARGET} SHARED " " ${SHARED_LINK_FLAGS})
+ target_include_directories (${HDF5_F90_TEST_LIBSH_TARGET}
+ PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ target_compile_definitions(${HDF5_F90_TEST_LIBSH_TARGET}
+ PUBLIC "H5_BUILT_AS_DYNAMIC_LIB"
+ PRIVATE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"BUILD_HDF5_TEST_DLL;HDF5F90_WINDOWS">
+ )
+ TARGET_FORTRAN_PROPERTIES (${HDF5_F90_TEST_LIBSH_TARGET} SHARED)
target_link_libraries (${HDF5_F90_TEST_LIBSH_TARGET}
- ${HDF5_F90_C_TEST_LIBSH_TARGET}
- ${HDF5_F90_LIBSH_TARGET}
- ${HDF5_LIBSH_TARGET}
+ PUBLIC ${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}
+ INTERFACE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/DLL">
)
H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_TEST_LIB_NAME} SHARED "F")
- target_include_directories (${HDF5_F90_TEST_LIBSH_TARGET} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
- set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared")
set_target_properties (${HDF5_F90_TEST_LIBSH_TARGET} PROPERTIES
FOLDER libraries/test/fortran
LINKER_LANGUAGE Fortran
- COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB"
- INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
- INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
)
- if (WIN32)
- set_property (TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY
- COMPILE_DEFINITIONS "BUILD_HDF5_TEST_DLL;HDF5F90_WINDOWS"
- )
- endif ()
add_dependencies(${HDF5_F90_TEST_LIBSH_TARGET} H5testgenSH)
endif ()
@@ -190,17 +181,14 @@ add_executable (testhdf5_fortran
tH5Z.F90
tHDF5.F90
)
-TARGET_FORTRAN_PROPERTIES (testhdf5_fortran STATIC " " " ")
-target_link_libraries (testhdf5_fortran
+target_include_directories (testhdf5_fortran PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static")
+TARGET_FORTRAN_PROPERTIES (testhdf5_fortran STATIC)
+target_link_libraries (testhdf5_fortran PRIVATE
${HDF5_F90_TEST_LIB_TARGET}
${HDF5_F90_LIB_TARGET}
${HDF5_LIB_TARGET}
+ $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
-if (WIN32 AND MSVC)
- target_link_libraries (testhdf5_fortran "ws2_32.lib")
-endif ()
-target_include_directories (testhdf5_fortran PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
-set_property(TARGET testhdf5_fortran APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static")
set_target_properties (testhdf5_fortran PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
@@ -226,17 +214,14 @@ if (BUILD_SHARED_LIBS)
tH5Z.F90
tHDF5.F90
)
- TARGET_FORTRAN_PROPERTIES (testhdf5_fortran-shared SHARED " " " ")
- target_link_libraries (testhdf5_fortran-shared
+ target_include_directories (testhdf5_fortran-shared PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared")
+ TARGET_FORTRAN_PROPERTIES (testhdf5_fortran-shared SHARED)
+ target_link_libraries (testhdf5_fortran-shared PRIVATE
${HDF5_F90_TEST_LIBSH_TARGET}
${HDF5_F90_LIBSH_TARGET}
${HDF5_LIBSH_TARGET}
+ $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
- if (WIN32 AND MSVC)
- target_link_libraries (testhdf5_fortran-shared "ws2_32.lib")
- endif ()
- target_include_directories (testhdf5_fortran-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
- set_property(TARGET testhdf5_fortran-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared")
set_target_properties (testhdf5_fortran-shared PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
@@ -254,17 +239,14 @@ add_executable (testhdf5_fortran_1_8
tH5MISC_1_8.F90
tHDF5_1_8.F90
)
-TARGET_FORTRAN_PROPERTIES (testhdf5_fortran_1_8 STATIC " " " ")
-target_link_libraries (testhdf5_fortran_1_8
+target_include_directories (testhdf5_fortran_1_8 PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static")
+TARGET_FORTRAN_PROPERTIES (testhdf5_fortran_1_8 STATIC)
+target_link_libraries (testhdf5_fortran_1_8 PRIVATE
${HDF5_F90_TEST_LIB_TARGET}
${HDF5_F90_LIB_TARGET}
${HDF5_LIB_TARGET}
+ $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
-if (WIN32 AND MSVC)
- target_link_libraries (testhdf5_fortran_1_8 "ws2_32.lib")
-endif ()
-target_include_directories (testhdf5_fortran_1_8 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
-set_property(TARGET testhdf5_fortran_1_8 APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static")
set_target_properties (testhdf5_fortran_1_8 PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
@@ -281,17 +263,14 @@ if (BUILD_SHARED_LIBS)
tH5MISC_1_8.F90
tHDF5_1_8.F90
)
- TARGET_FORTRAN_PROPERTIES (testhdf5_fortran_1_8-shared SHARED " " " ")
- target_link_libraries (testhdf5_fortran_1_8-shared
+ target_include_directories (testhdf5_fortran_1_8-shared PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared")
+ TARGET_FORTRAN_PROPERTIES (testhdf5_fortran_1_8-shared SHARED)
+ target_link_libraries (testhdf5_fortran_1_8-shared PRIVATE
${HDF5_F90_TEST_LIBSH_TARGET}
${HDF5_F90_LIBSH_TARGET}
${HDF5_LIBSH_TARGET}
+ $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
- if (WIN32 AND MSVC)
- target_link_libraries (testhdf5_fortran_1_8-shared "ws2_32.lib")
- endif ()
- target_include_directories (testhdf5_fortran_1_8-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
- set_property(TARGET testhdf5_fortran_1_8-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared")
set_target_properties (testhdf5_fortran_1_8-shared PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
@@ -311,17 +290,14 @@ add_executable (fortranlib_test_F03
tH5T_F03.F90
tHDF5_F03.F90
)
-TARGET_FORTRAN_PROPERTIES (fortranlib_test_F03 STATIC " " " ")
-target_link_libraries (fortranlib_test_F03
+target_include_directories (fortranlib_test_F03 PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static")
+TARGET_FORTRAN_PROPERTIES (fortranlib_test_F03 STATIC)
+target_link_libraries (fortranlib_test_F03 PRIVATE
${HDF5_F90_TEST_LIB_TARGET}
${HDF5_F90_LIB_TARGET}
${HDF5_LIB_TARGET}
+ $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
-if (WIN32 AND MSVC)
- target_link_libraries (fortranlib_test_F03 "ws2_32.lib")
-endif ()
-target_include_directories (fortranlib_test_F03 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
-set_property(TARGET fortranlib_test_F03 APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static")
set_target_properties (fortranlib_test_F03 PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
@@ -340,18 +316,14 @@ if (BUILD_SHARED_LIBS)
tH5T_F03.F90
tHDF5_F03.F90
)
- TARGET_FORTRAN_PROPERTIES (fortranlib_test_F03-shared SHARED " " " ")
- target_link_libraries (fortranlib_test_F03-shared
+ target_include_directories (fortranlib_test_F03-shared PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared")
+ TARGET_FORTRAN_PROPERTIES (fortranlib_test_F03-shared SHARED)
+ target_link_libraries (fortranlib_test_F03-shared PRIVATE
${HDF5_F90_TEST_LIBSH_TARGET}
${HDF5_F90_LIBSH_TARGET}
${HDF5_LIBSH_TARGET}
+ $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
- if (WIN32 AND MSVC)
- target_link_libraries (fortranlib_test_F03-shared "ws2_32.lib")
- endif ()
-
- target_include_directories (fortranlib_test_F03-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
- set_property(TARGET fortranlib_test_F03-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared")
set_target_properties (fortranlib_test_F03-shared PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
@@ -362,16 +334,14 @@ endif ()
#-- Adding test for fflush1
add_executable (fflush1 fflush1.F90)
-TARGET_FORTRAN_PROPERTIES (fflush1 STATIC " " " ")
-target_link_libraries (fflush1
+target_include_directories (fflush1 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
+TARGET_FORTRAN_PROPERTIES (fflush1 STATIC)
+target_link_libraries (fflush1 PRIVATE
${HDF5_F90_LIB_TARGET}
${HDF5_F90_TEST_LIB_TARGET}
${HDF5_LIB_TARGET}
+ $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
-if (WIN32 AND MSVC)
- target_link_libraries (fflush1 "ws2_32.lib")
-endif ()
-target_include_directories (fflush1 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
set_target_properties (fflush1 PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
@@ -381,16 +351,14 @@ add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET})
if (BUILD_SHARED_LIBS)
add_executable (fflush1-shared fflush1.F90)
- TARGET_FORTRAN_PROPERTIES (fflush1-shared SHARED " " " ")
- target_link_libraries (fflush1-shared
+ target_include_directories (fflush1-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
+ TARGET_FORTRAN_PROPERTIES (fflush1-shared SHARED)
+ target_link_libraries (fflush1-shared PRIVATE
${HDF5_F90_LIBSH_TARGET}
${HDF5_F90_TEST_LIBSH_TARGET}
${HDF5_LIBSH_TARGET}
+ $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
- if (WIN32 AND MSVC)
- target_link_libraries (fflush1-shared "ws2_32.lib")
- endif ()
- target_include_directories (fflush1-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
set_target_properties (fflush1-shared PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
@@ -401,16 +369,14 @@ endif ()
#-- Adding test for fflush2
add_executable (fflush2 fflush2.F90)
-TARGET_FORTRAN_PROPERTIES (fflush2 STATIC " " " ")
-target_link_libraries (fflush2
+target_include_directories (fflush2 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
+TARGET_FORTRAN_PROPERTIES (fflush2 STATIC)
+target_link_libraries (fflush2 PRIVATE
${HDF5_F90_TEST_LIB_TARGET}
${HDF5_F90_LIB_TARGET}
${HDF5_LIB_TARGET}
+ $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
-if (WIN32 AND MSVC)
- target_link_libraries (fflush2 "ws2_32.lib")
-endif ()
-target_include_directories (fflush2 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
set_target_properties (fflush2 PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
@@ -420,16 +386,14 @@ add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET})
if (BUILD_SHARED_LIBS)
add_executable (fflush2-shared fflush2.F90)
- TARGET_FORTRAN_PROPERTIES (fflush2-shared SHARED " " " ")
- target_link_libraries (fflush2-shared
+ target_include_directories (fflush2-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
+ TARGET_FORTRAN_PROPERTIES (fflush2-shared SHARED)
+ target_link_libraries (fflush2-shared PRIVATE
${HDF5_F90_TEST_LIBSH_TARGET}
${HDF5_F90_LIBSH_TARGET}
${HDF5_LIBSH_TARGET}
+ $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
- if (WIN32 AND MSVC)
- target_link_libraries (fflush2-shared "ws2_32.lib")
- endif ()
- target_include_directories (fflush2-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
set_target_properties (fflush2-shared PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran