diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2018-04-30 14:03:29 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2018-04-30 14:03:29 (GMT) |
commit | 76d0cc0ca992e3f373c64ddc578ebfed09c77455 (patch) | |
tree | fc76278eee4526f38688aff3d0b5afd1431ff74c /fortran/test/CMakeLists.txt | |
parent | 80afe46e70a824086f4744081eaf92836639109d (diff) | |
download | hdf5-76d0cc0ca992e3f373c64ddc578ebfed09c77455.zip hdf5-76d0cc0ca992e3f373c64ddc578ebfed09c77455.tar.gz hdf5-76d0cc0ca992e3f373c64ddc578ebfed09c77455.tar.bz2 |
TRILABS-19 Refactor fortran properties
Diffstat (limited to 'fortran/test/CMakeLists.txt')
-rw-r--r-- | fortran/test/CMakeLists.txt | 287 |
1 files changed, 188 insertions, 99 deletions
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 () |