summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2018-04-30 14:03:29 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2018-04-30 14:03:29 (GMT)
commit76d0cc0ca992e3f373c64ddc578ebfed09c77455 (patch)
treefc76278eee4526f38688aff3d0b5afd1431ff74c /fortran
parent80afe46e70a824086f4744081eaf92836639109d (diff)
downloadhdf5-76d0cc0ca992e3f373c64ddc578ebfed09c77455.zip
hdf5-76d0cc0ca992e3f373c64ddc578ebfed09c77455.tar.gz
hdf5-76d0cc0ca992e3f373c64ddc578ebfed09c77455.tar.bz2
TRILABS-19 Refactor fortran properties
Diffstat (limited to 'fortran')
-rw-r--r--fortran/examples/CMakeLists.txt117
-rw-r--r--fortran/src/CMakeLists.txt56
-rw-r--r--fortran/test/CMakeLists.txt287
-rw-r--r--fortran/testpar/CMakeLists.txt28
4 files changed, 324 insertions, 164 deletions
diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt
index f9ee539..d89fbdc 100644
--- a/fortran/examples/CMakeLists.txt
+++ b/fortran/examples/CMakeLists.txt
@@ -35,99 +35,144 @@ set (F2003_examples
foreach (example ${examples})
add_executable (f90_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
- TARGET_FORTRAN_PROPERTIES (f90_ex_${example} STATIC)
- target_link_libraries (f90_ex_${example} PRIVATE
- ${HDF5_F90_LIB_TARGET}
- ${HDF5_LIB_TARGET}
+ target_include_directories (f90_ex_${example}
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
)
- target_include_directories (f90_ex_${example} PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
+ target_compile_options(f90_ex_${example}
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ )
+ target_link_libraries (f90_ex_${example}
+ PRIVATE
+ ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}
)
set_target_properties (f90_ex_${example} PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER examples/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
if (BUILD_SHARED_LIBS)
add_executable (f90_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
- TARGET_FORTRAN_PROPERTIES (f90_ex_${example}-shared SHARED)
- target_link_libraries (f90_ex_${example}-shared PRIVATE
- ${HDF5_F90_LIBSH_TARGET}
- ${HDF5_LIBSH_TARGET}
+ target_include_directories (f90_ex_${example}-shared
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ )
+ target_compile_options(${forttarget}
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/dll">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
- target_include_directories (f90_ex_${example}-shared PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ target_link_libraries (f90_ex_${example}-shared
+ PRIVATE
+ ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}
)
set_target_properties (f90_ex_${example}-shared PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER examples/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
endif ()
endforeach ()
foreach (example ${F2003_examples})
add_executable (f03_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
- TARGET_FORTRAN_PROPERTIES (f03_ex_${example} STATIC)
- target_link_libraries (f03_ex_${example} PRIVATE
- ${HDF5_F90_LIB_TARGET}
- ${HDF5_LIB_TARGET}
+ target_include_directories (f03_ex_${example}
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
+ )
+ target_compile_options(f03_ex_${example}
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
- target_include_directories (f03_ex_${example} PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
+ target_link_libraries (f03_ex_${example}
+ PRIVATE
+ ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}
)
set_target_properties (f03_ex_${example} PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER examples/fortran03
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
if (BUILD_SHARED_LIBS)
add_executable (f03_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
- TARGET_FORTRAN_PROPERTIES (f03_ex_${example}-shared SHARED)
- target_link_libraries (f03_ex_${example}-shared PRIVATE
- ${HDF5_F90_LIBSH_TARGET}
- ${HDF5_LIBSH_TARGET}
+ target_include_directories (f03_ex_${example}-shared
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
)
- target_include_directories (f03_ex_${example}-shared PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ target_compile_options(${forttarget}
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/dll">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ )
+ target_link_libraries (f03_ex_${example}-shared
+ PRIVATE
+ ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}
)
set_target_properties (f03_ex_${example}-shared PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER examples/fortran03
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
endif ()
endforeach ()
if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
add_executable (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90)
- TARGET_FORTRAN_PROPERTIES (f90_ex_ph5example STATIC)
- target_link_libraries (f90_ex_ph5example PRIVATE
- ${HDF5_F90_LIB_TARGET}
- ${HDF5_LIB_TARGET}
+ target_include_directories (f90_ex_ph5example
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
+ )
+ target_compile_options(f90_ex_ph5example
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
- target_include_directories (f90_ex_ph5example PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
+ target_link_libraries (f90_ex_ph5example
+ PRIVATE
+ ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}
)
set_target_properties (f90_ex_ph5example PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER examples/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
if (BUILD_SHARED_LIBS)
add_executable (f90_ex_ph5example-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90)
- TARGET_FORTRAN_PROPERTIES (f90_ex_ph5example-shared SHARED)
- target_link_libraries (f90_ex_ph5example-shared PRIVATE
- ${HDF5_F90_LIBSH_TARGET}
- ${HDF5_LIBSH_TARGET}
+ target_include_directories (f90_ex_ph5example-shared
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ )
+ target_compile_options(${forttarget}
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/dll">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
- target_include_directories (f90_ex_ph5example-shared PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ target_link_libraries (f90_ex_ph5example-shared
+ PRIVATE
+ ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}
)
set_target_properties (f90_ex_ph5example-shared PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER examples/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
endif ()
endif ()
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt
index c53a90f..4081f2b 100644
--- a/fortran/src/CMakeLists.txt
+++ b/fortran/src/CMakeLists.txt
@@ -245,51 +245,69 @@ endif ()
#-----------------------------------------------------------------------------
add_library (${HDF5_F90_LIB_TARGET} STATIC ${f90_F_SOURCES})
target_include_directories (${HDF5_F90_LIB_TARGET}
- PRIVATE "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>"
- INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ PRIVATE
+ "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>"
+ INTERFACE
+ "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
target_compile_definitions(${HDF5_F90_LIB_TARGET}
- PRIVATE $<$<STREQUAL:"xx","MSVC">:"HDF5F90_WINDOWS">
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"HDF5F90_WINDOWS">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
-set (SHARED_LINK_FLAGS " ")
-TARGET_FORTRAN_PROPERTIES (${HDF5_F90_LIB_TARGET} STATIC)
target_link_libraries (${HDF5_F90_LIB_TARGET}
- PUBLIC ${HDF5_F90_C_LIB_TARGET}
- PRIVATE ${LINK_Fortran_LIBS} $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}>
+ PUBLIC
+ ${HDF5_F90_C_LIB_TARGET}
+ PRIVATE
+ ${LINK_Fortran_LIBS} $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}>
)
-set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}")
-H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC 0)
set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES
FOLDER libraries/fortran
LINKER_LANGUAGE Fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
+H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC 0)
+set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}")
set (install_targets ${install_targets} ${HDF5_F90_LIB_TARGET})
add_dependencies(${HDF5_F90_LIB_TARGET} H5gen)
if (BUILD_SHARED_LIBS)
add_library (${HDF5_F90_LIBSH_TARGET} SHARED ${f90_F_SOURCES_SHARED})
target_include_directories (${HDF5_F90_LIBSH_TARGET}
- PRIVATE "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>"
- INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ PRIVATE
+ "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>"
+ INTERFACE
+ "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
target_compile_definitions(${HDF5_F90_LIBSH_TARGET}
- PUBLIC "H5_BUILT_AS_DYNAMIC_LIB"
- PRIVATE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"BUILD_HDF5_DLL;HDF5F90_WINDOWS">
+ PUBLIC
+ "H5_BUILT_AS_DYNAMIC_LIB"
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"BUILD_HDF5_DLL;HDF5F90_WINDOWS">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/dll">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
- TARGET_FORTRAN_PROPERTIES (${HDF5_F90_LIBSH_TARGET} SHARED)
target_link_libraries (${HDF5_F90_LIBSH_TARGET}
- PUBLIC ${HDF5_F90_C_LIBSH_TARGET}
- PRIVATE ${LINK_Fortran_LIBS} $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}>
- INTERFACE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/DLL /DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def">
+ PUBLIC
+ ${HDF5_F90_C_LIBSH_TARGET}
+ PRIVATE
+ ${LINK_Fortran_LIBS} $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}>
+ INTERFACE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/DLL /DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def">
)
- set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIBSH_TARGET}")
- H5_SET_LIB_OPTIONS (${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_LIB_NAME} SHARED "F")
set_target_properties (${HDF5_F90_LIBSH_TARGET} PROPERTIES
FOLDER libraries/fortran
LINKER_LANGUAGE Fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
+ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIBSH_TARGET}")
+ H5_SET_LIB_OPTIONS (${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_LIB_NAME} SHARED "F")
set (install_targets ${install_targets} ${HDF5_F90_LIBSH_TARGET})
add_dependencies(${HDF5_F90_LIBSH_TARGET} H5genSH)
endif ()
diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt
index 1fb26f5..73bfc19 100644
--- a/fortran/test/CMakeLists.txt
+++ b/fortran/test/CMakeLists.txt
@@ -115,47 +115,62 @@ endif ()
add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC ${HDF5_F90_TF_SOURCES})
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>"
+ 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">
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"HDF5F90_WINDOWS">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
-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}
+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)
set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES
FOLDER libraries/test/fortran
LINKER_LANGUAGE Fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
+H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} STATIC 0)
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})
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>"
+ 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">
+ PUBLIC
+ "H5_BUILT_AS_DYNAMIC_LIB"
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"BUILD_HDF5_TEST_DLL;HDF5F90_WINDOWS">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/dll">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
- TARGET_FORTRAN_PROPERTIES (${HDF5_F90_TEST_LIBSH_TARGET} SHARED)
target_link_libraries (${HDF5_F90_TEST_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">
+ 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")
set_target_properties (${HDF5_F90_TEST_LIBSH_TARGET} PROPERTIES
FOLDER libraries/test/fortran
LINKER_LANGUAGE Fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
+ H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_TEST_LIB_NAME} SHARED "F")
add_dependencies(${HDF5_F90_TEST_LIBSH_TARGET} H5testgenSH)
endif ()
@@ -181,18 +196,24 @@ add_executable (testhdf5_fortran
tH5Z.F90
tHDF5.F90
)
-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>
+target_include_directories (testhdf5_fortran
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static")
+target_compile_options(testhdf5_fortran
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+)
+target_link_libraries (testhdf5_fortran
+ PRIVATE
+ ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
set_target_properties (testhdf5_fortran PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET})
@@ -214,18 +235,26 @@ if (BUILD_SHARED_LIBS)
tH5Z.F90
tHDF5.F90
)
- 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>
+ target_include_directories (testhdf5_fortran-shared
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ )
+ target_compile_options(testhdf5_fortran-shared
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/dll">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ )
+ 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>
)
set_target_properties (testhdf5_fortran-shared PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER test/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ LINKER_LANGUAGE Fortran
+ FOLDER test/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
add_dependencies (testhdf5_fortran-shared ${HDF5_F90_TEST_LIBSH_TARGET})
endif ()
@@ -239,18 +268,25 @@ add_executable (testhdf5_fortran_1_8
tH5MISC_1_8.F90
tHDF5_1_8.F90
)
-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>
+target_include_directories (testhdf5_fortran_1_8
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
+)
+target_compile_options(testhdf5_fortran_1_8
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+)
+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>
)
set_target_properties (testhdf5_fortran_1_8 PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET})
@@ -263,18 +299,26 @@ if (BUILD_SHARED_LIBS)
tH5MISC_1_8.F90
tHDF5_1_8.F90
)
- 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>
+ target_include_directories (testhdf5_fortran_1_8-shared
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ )
+ target_compile_options(testhdf5_fortran_1_8-shared
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/dll">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ )
+ 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>
)
set_target_properties (testhdf5_fortran_1_8-shared PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER test/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ LINKER_LANGUAGE Fortran
+ FOLDER test/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
add_dependencies (testhdf5_fortran_1_8-shared ${HDF5_F90_TEST_LIBSH_TARGET})
endif ()
@@ -290,18 +334,25 @@ add_executable (fortranlib_test_F03
tH5T_F03.F90
tHDF5_F03.F90
)
-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>
+target_include_directories (fortranlib_test_F03
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
+)
+target_compile_options(fortranlib_test_F03
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+)
+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>
)
set_target_properties (fortranlib_test_F03 PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET})
@@ -316,88 +367,126 @@ if (BUILD_SHARED_LIBS)
tH5T_F03.F90
tHDF5_F03.F90
)
- 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>
+ target_include_directories (fortranlib_test_F03-shared
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ )
+ target_compile_options(fortranlib_test_F03-shared
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/dll">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ )
+ 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>
)
set_target_properties (fortranlib_test_F03-shared PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
add_dependencies (fortranlib_test_F03-shared ${HDF5_F90_TEST_LIBSH_TARGET})
endif ()
#-- Adding test for fflush1
add_executable (fflush1 fflush1.F90)
-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>
+target_include_directories (fflush1
+ PRIVATE
+ ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+)
+target_compile_options(fflush1
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+)
+target_link_libraries (fflush1
+ PRIVATE
+ ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
set_target_properties (fflush1 PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET})
if (BUILD_SHARED_LIBS)
add_executable (fflush1-shared fflush1.F90)
- 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>
+ target_include_directories (fflush1-shared
+ PRIVATE
+ ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ )
+ target_compile_options(fflush1-shared
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/dll">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ )
+ target_link_libraries (fflush1-shared
+ PRIVATE
+ ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
set_target_properties (fflush1-shared PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER test/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ LINKER_LANGUAGE Fortran
+ FOLDER test/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
add_dependencies (fflush1-shared ${HDF5_F90_TEST_LIBSH_TARGET})
endif ()
#-- Adding test for fflush2
add_executable (fflush2 fflush2.F90)
-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>
+target_include_directories (fflush2
+ PRIVATE
+ ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+)
+target_compile_options (fflush2
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+)
+target_link_libraries (fflush2
+ PRIVATE
+ ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
set_target_properties (fflush2 PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET})
if (BUILD_SHARED_LIBS)
add_executable (fflush2-shared fflush2.F90)
- 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>
+ target_include_directories (fflush2-shared
+ PRIVATE
+ ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ )
+ target_compile_options(fflush2-shared
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/dll">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ )
+ target_link_libraries (fflush2-shared
+ PRIVATE
+ ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
set_target_properties (fflush2-shared PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER test/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ LINKER_LANGUAGE Fortran
+ FOLDER test/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
add_dependencies (fflush2-shared ${HDF5_F90_TEST_LIBSH_TARGET})
endif ()
diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt
index a6984b7..f08d6a6 100644
--- a/fortran/testpar/CMakeLists.txt
+++ b/fortran/testpar/CMakeLists.txt
@@ -16,18 +16,26 @@ add_executable (parallel_test
hyper.f90
mdset.f90
)
-TARGET_FORTRAN_PROPERTIES (parallel_test STATIC)
+target_include_directories (parallel_test
+ PRIVATE
+ ${TESTPAR_INCLUDES}
+)
+target_compile_options(parallel_test
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+)
target_link_libraries (parallel_test
- ${HDF5_F90_TEST_LIB_TARGET}
- ${HDF5_F90_LIB_TARGET}
- ${HDF5_LIB_TARGET}
- ${LINK_Fortran_LIBS}
+ PRIVATE
+ ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_Fortran_LIBS}
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"ws2_32.lib">
+)
+set_target_properties (parallel_test PROPERTIES
+ FOLDER test/fortran
+ LINKER_LANGUAGE Fortran
+ LINK_FLAGS
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/SUBSYSTEM:CONSOLE">
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
)
-if (WIN32 AND MSVC)
- target_link_libraries (parallel_test "ws2_32.lib")
endif ()
-target_include_directories (parallel_test PRIVATE ${TESTPAR_INCLUDES})
-set_target_properties (parallel_test PROPERTIES LINKER_LANGUAGE Fortran)
-set_target_properties (parallel_test PROPERTIES FOLDER test/fortran)
include (CMakeTests.cmake)