diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2018-05-03 15:44:57 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2018-05-03 15:44:57 (GMT) |
commit | 01a77cbfb17d8802a9f135bb95a2b2ec57f75410 (patch) | |
tree | 5ddb626fd46c8f784b890f5a575f0ab5eccfe2c6 | |
parent | 1ab0814a4320eb8a4b93a85048419302218aeb34 (diff) | |
download | hdf5-01a77cbfb17d8802a9f135bb95a2b2ec57f75410.zip hdf5-01a77cbfb17d8802a9f135bb95a2b2ec57f75410.tar.gz hdf5-01a77cbfb17d8802a9f135bb95a2b2ec57f75410.tar.bz2 |
LINK_FLAGS must be separate property sets
-rw-r--r-- | config/cmake/HDF5Macros.cmake | 4 | ||||
-rw-r--r-- | fortran/examples/CMakeLists.txt | 54 | ||||
-rw-r--r-- | fortran/src/CMakeLists.txt | 31 | ||||
-rw-r--r-- | fortran/test/CMakeLists.txt | 120 | ||||
-rw-r--r-- | fortran/testpar/CMakeLists.txt | 9 | ||||
-rw-r--r-- | hl/fortran/examples/CMakeLists.txt | 12 | ||||
-rw-r--r-- | hl/fortran/src/CMakeLists.txt | 31 | ||||
-rw-r--r-- | hl/fortran/test/CMakeLists.txt | 217 | ||||
-rw-r--r-- | hl/fortran/test/CMakeTests.cmake | 167 |
9 files changed, 260 insertions, 385 deletions
diff --git a/config/cmake/HDF5Macros.cmake b/config/cmake/HDF5Macros.cmake index e472a67..7048db6 100644 --- a/config/cmake/HDF5Macros.cmake +++ b/config/cmake/HDF5Macros.cmake @@ -33,8 +33,10 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype libpackage) if (APPLE) option (HDF5_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF) if (HDF5_BUILD_WITH_INSTALL_NAME) - set_target_properties (${libtarget} PROPERTIES + set_property(TARGET ${libtarget} APPEND_STRING PROPERTY LINK_FLAGS "-current_version ${HDF5_PACKAGE_VERSION} -compatibility_version ${HDF5_PACKAGE_VERSION}" + ) + set_target_properties (${libtarget} PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" BUILD_WITH_INSTALL_RPATH ${HDF5_BUILD_WITH_INSTALL_NAME} ) diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 3347480..5329e29 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -47,13 +47,16 @@ foreach (example ${examples}) PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) + set_property(TARGET f90_ex_${example} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET f90_ex_${example} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> + ) 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) @@ -70,13 +73,16 @@ foreach (example ${examples}) PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) + set_property(TARGET f90_ex_${example}-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET f90_ex_${example}-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> + ) 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 () @@ -95,13 +101,16 @@ foreach (example ${F2003_examples}) PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) + set_property(TARGET f03_ex_${example} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET f03_ex_${example} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> + ) 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) @@ -118,13 +127,16 @@ foreach (example ${F2003_examples}) PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) + set_property(TARGET f03_ex_${example}-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET f03_ex_${example}-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> + ) 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 () @@ -143,13 +155,16 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) + set_property(TARGET f90_ex_ph5example APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET f90_ex_ph5example APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> + ) 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) @@ -166,13 +181,16 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) + set_property(TARGET f90_ex_ph5example-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET f90_ex_ph5example-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> + ) 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 cbc14c3..670e159 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -54,11 +54,12 @@ if (BUILD_SHARED_LIBS) $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:/MT> ) endif () +set_property(TARGET H5_buildiface APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> +) set_target_properties (H5_buildiface PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} - LINK_FLAGS - "$<$<STREQUAL:\"x${CMAKE_Fortran_SIMULATE_ID}\",\"xMSVC\">:\"-SUBSYSTEM:CONSOLE\">" ) if (BUILD_SHARED_LIBS) @@ -265,13 +266,16 @@ target_link_libraries (${HDF5_F90_LIB_TARGET} ${LINK_Fortran_LIBS} $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}> ) +set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> +) +set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> +) 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}") @@ -300,15 +304,22 @@ if (BUILD_SHARED_LIBS) PRIVATE ${LINK_Fortran_LIBS} $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}> ) + set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> + ) + set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-DLL"> + ) + set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def"> + ) 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}> - $<$<STREQUAL:\"x${CMAKE_Fortran_SIMULATE_ID}\",\"xMSVC\">:\"-DLL\"> - $<$<STREQUAL:\"x${CMAKE_Fortran_SIMULATE_ID}\",\"xMSVC\">:\"-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") diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index d1247a1..964d588 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -17,11 +17,12 @@ if (BUILD_SHARED_LIBS) $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:/MT> ) endif () +set_property(TARGET H5_test_buildiface APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> +) set_target_properties (H5_test_buildiface PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} - LINK_FLAGS - "$<$<STREQUAL:\"x${CMAKE_Fortran_SIMULATE_ID}\",\"xMSVC\">:\"-SUBSYSTEM:CONSOLE\">" ) if (BUILD_SHARED_LIBS) @@ -132,13 +133,16 @@ target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} PUBLIC ${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) +set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> +) +set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> +) 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) @@ -163,14 +167,19 @@ if (BUILD_SHARED_LIBS) PUBLIC ${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) + set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> + ) + set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-DLL"> + ) 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}> - $<$<STREQUAL:\"x${CMAKE_Fortran_SIMULATE_ID}\",\"xMSVC\">:\"-DLL\">" ) H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_TEST_LIB_NAME} SHARED "F") add_dependencies(${HDF5_F90_TEST_LIBSH_TARGET} H5testgenSH) @@ -200,7 +209,8 @@ add_executable (testhdf5_fortran ) target_include_directories (testhdf5_fortran PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static") + "${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}> @@ -209,13 +219,16 @@ 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_property(TARGET testhdf5_fortran APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> +) +set_property(TARGET testhdf5_fortran APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> +) 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}) @@ -250,13 +263,16 @@ if (BUILD_SHARED_LIBS) PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> ) + set_property(TARGET testhdf5_fortran-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET testhdf5_fortran-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> + ) set_target_properties (testhdf5_fortran-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 (testhdf5_fortran-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -282,13 +298,16 @@ 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_property(TARGET testhdf5_fortran_1_8 APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> +) +set_property(TARGET testhdf5_fortran_1_8 APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> +) 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}) @@ -314,13 +333,16 @@ if (BUILD_SHARED_LIBS) PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> ) + set_property(TARGET testhdf5_fortran_1_8-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET testhdf5_fortran_1_8-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> + ) set_target_properties (testhdf5_fortran_1_8-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 (testhdf5_fortran_1_8-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -348,13 +370,16 @@ 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_property(TARGET fortranlib_test_F03 APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> +) +set_property(TARGET fortranlib_test_F03 APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> +) 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}) @@ -382,13 +407,16 @@ if (BUILD_SHARED_LIBS) PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> ) + set_property(TARGET fortranlib_test_F03-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET fortranlib_test_F03-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> + ) 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 () @@ -407,13 +435,16 @@ target_link_libraries (fflush1 PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> ) +set_property(TARGET fflush1 APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> +) +set_property(TARGET fflush1 APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> +) 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}) @@ -432,13 +463,16 @@ if (BUILD_SHARED_LIBS) PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> ) + set_property(TARGET fflush1-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET fflush1-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> + ) set_target_properties (fflush1-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 (fflush1-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -457,13 +491,16 @@ target_link_libraries (fflush2 PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> ) +set_property(TARGET fflush2 APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> +) +set_property(TARGET fflush2 APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> +) 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}) @@ -482,13 +519,16 @@ if (BUILD_SHARED_LIBS) PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib> ) + set_property(TARGET fflush2-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET fflush2-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> + ) set_target_properties (fflush2-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 (fflush2-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index 3d89e5e..5ead405 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -29,12 +29,15 @@ target_link_libraries (parallel_test ${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_property(TARGET parallel_test APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> +) +set_property(TARGET parallel_test APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> +) 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}>" ) endif () diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index 05cfaa4..97ddce8 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -20,18 +20,18 @@ foreach (example ${examples}) PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) + set_property(TARGET hl_f90_ex_${example} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET hl_f90_ex_${example} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> + ) set_target_properties (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/hl/fortran - LINK_FLAGS - "$<$<STREQUAL:\"x${CMAKE_Fortran_SIMULATE_ID}\",\"xMSVC\">:\"-SUBSYSTEM:CONSOLE\"> - $<$<STREQUAL:\"x${CMAKE_Fortran_SIMULATE_ID}\",\"xMSVC\">:${WIN_LINK_FLAGS}>" ) - endforeach () if (BUILD_TESTING) - include (CMakeTests.cmake) - endif () diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index a4cb21d..6aec901 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -22,11 +22,12 @@ if (WIN32 AND MSVC) set_target_properties (H5HL_buildiface PROPERTIES COMPILE_FLAGS "/MT") endif () endif () +set_property(TARGET H5HL_buildiface APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> +) set_target_properties (H5HL_buildiface PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} - LINK_FLAGS - "$<$<STREQUAL:\"x${CMAKE_Fortran_SIMULATE_ID}\",\"xMSVC\">:\"-SUBSYSTEM:CONSOLE\">" ) if (BUILD_SHARED_LIBS) @@ -165,13 +166,16 @@ target_link_libraries (${HDF5_HL_F90_LIB_TARGET} PUBLIC ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ) +set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> +) +set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> +) set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES FOLDER libraries/hl/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_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} STATIC 0) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}") @@ -200,15 +204,22 @@ if (BUILD_SHARED_LIBS) PRIVATE ${LINK_Fortran_LIBS} ) + set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> + ) + set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-DLL"> + ) + set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def"> + ) set_target_properties (${HDF5_HL_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl/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}> - $<$<STREQUAL:\"x${CMAKE_Fortran_SIMULATE_ID}\",\"xMSVC\">:\"-DLL\"> - $<$<STREQUAL:\"x${CMAKE_Fortran_SIMULATE_ID}\",\"xMSVC\">:\"-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def\">" ) H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_LIB_NAME} SHARED "HL_F") set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIBSH_TARGET}") diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index 40afcd3..d6d1ab0 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -4,189 +4,68 @@ project (HDF5_HL_FORTRAN_TESTS C Fortran) #----------------------------------------------------------------------------- # Add Tests #----------------------------------------------------------------------------- - -#-- Adding test for hl_f90_tstds -add_executable (hl_f90_tstds tstds.F90) -target_include_directories (hl_f90_tstds - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" -) -target_compile_options(hl_f90_tstds - PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> -) -target_link_libraries (hl_f90_tstds - PRIVATE - ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} +set (H5_TESTS + tstds + tstlite + tstimage + tsttable ) -set_target_properties (hl_f90_tstds PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/hl/fortran - 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 (hl_f90_tstds-shared tstds.F90) - target_include_directories (hl_f90_tstds-shared - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" - ) - target_compile_options(hl_f90_tstds-shared - PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:/dll> - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> - ) - target_link_libraries (hl_f90_tstds-shared - PRIVATE - ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} - ) - set_target_properties (hl_f90_tstds-shared PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/hl/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 () -#-- Adding test for hl_f90_tstlite -add_executable (hl_f90_tstlite tstlite.F90) -target_include_directories (hl_f90_tstlite - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" -) -target_compile_options(hl_f90_tstlite - PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> -) -target_link_libraries (hl_f90_tstlite - PRIVATE - ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} -) -set_target_properties (hl_f90_tstlite PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/hl/fortran - 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 (hl_f90_tstlite-shared tstlite.F90) - target_include_directories (hl_f90_tstlite-shared +macro (ADD_H5_FORTRAN_EXE file) + add_executable (hl_f90_${file} ${file}.F90) + target_include_directories (hl_f90_${file} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" ) - target_compile_options(hl_f90_tstlite-shared + target_compile_options(hl_f90_${file} PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:/dll> $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> ) - target_link_libraries (hl_f90_tstlite-shared + target_link_libraries (hl_f90_${file} PRIVATE - ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} + ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ) - set_target_properties (hl_f90_tstlite-shared PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/hl/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_property(TARGET hl_f90_${file} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> ) -endif () - -#-- Adding test for hl_f90_tstimage -add_executable (hl_f90_tstimage tstimage.F90) -target_include_directories (hl_f90_tstimage - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" -) -target_compile_options(hl_f90_tstimage - PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> -) -target_link_libraries (hl_f90_tstimage - PRIVATE - ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} -) -set_target_properties (hl_f90_tstimage PROPERTIES - FOLDER test/hl/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 (BUILD_SHARED_LIBS) - add_executable (hl_f90_tstimage-shared tstimage.F90) - target_include_directories (hl_f90_tstimage-shared - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" - ) - target_compile_options(hl_f90_tstimage-shared - PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:/dll> - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> + set_property(TARGET hl_f90_${file} APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> ) - target_link_libraries (hl_f90_tstimage-shared - PRIVATE - ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} - ) - set_target_properties (hl_f90_tstimage-shared PROPERTIES + set_target_properties (hl_f90_${file} PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/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 () + if (BUILD_SHARED_LIBS) + add_executable (hl_f90_${file}-shared ${file}.F90) + target_include_directories (hl_f90_${file}-shared + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" + ) + target_compile_options(hl_f90_${file}-shared + PRIVATE + $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:/dll> + $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (hl_f90_${file}-shared + PRIVATE + ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} + ) + set_property(TARGET hl_f90_${file}-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET hl_f90_${file}-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}> + ) + set_target_properties (hl_f90_${file}-shared PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/hl/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ) + endif () +endmacro () -#-- Adding test for hl_f90_tsttable -add_executable (hl_f90_tsttable tsttable.F90) -target_include_directories (hl_f90_tsttable - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" -) -target_compile_options(hl_f90_tsttable - PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> -) -target_link_libraries (hl_f90_tsttable - PRIVATE - ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} -) -set_target_properties (hl_f90_tsttable PROPERTIES - FOLDER test/hl/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 (BUILD_SHARED_LIBS) - add_executable (hl_f90_tsttable-shared tsttable.F90) - target_include_directories (hl_f90_tsttable-shared - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" - ) - target_compile_options(hl_f90_tsttable-shared - PRIVATE - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:/dll> - $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> - ) - target_link_libraries (hl_f90_tsttable-shared - PRIVATE - ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} - ) - set_target_properties (hl_f90_tsttable-shared PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/hl/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 () +foreach (test ${H5_TESTS}) + ADD_H5_FORTRAN_EXE(${test}) +endforeach () include (CMakeTests.cmake) diff --git a/hl/fortran/test/CMakeTests.cmake b/hl/fortran/test/CMakeTests.cmake index d541377..04a49dc 100644 --- a/hl/fortran/test/CMakeTests.cmake +++ b/hl/fortran/test/CMakeTests.cmake @@ -16,6 +16,41 @@ ############################################################################## ############################################################################## +macro (ADD_H5_FORTRAN_TEST file) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME HL_FORTRAN_f90_${file} COMMAND $<TARGET_FILE:hl_f90_${file}>) + else () + add_test (NAME HL_FORTRAN_f90_${file} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_${file}>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=hl_f90_${file}.txt" + #-D "TEST_REFERENCE=hl_f90_${file}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (HL_FORTRAN_f90_${file} PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects) + if (BUILD_SHARED_LIBS) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME HL_FORTRAN_f90_${file}-shared COMMAND $<TARGET_FILE:hl_f90_${file}-shared>) + else () + add_test (NAME HL_FORTRAN_f90_${file}-shared COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_${file}-shared>" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=hl_f90_${file}-shared.txt" + #-D "TEST_REFERENCE=hl_f90_${file}-shared.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (HL_FORTRAN_f90_${file}-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects) + endif () +endmacro () + # Remove any output file left over from previous test run add_test ( NAME HL_FORTRAN_test-clear-objects @@ -32,70 +67,6 @@ add_test ( tstds.h5 ) -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_tstds COMMAND $<TARGET_FILE:hl_f90_tstds>) -else () - add_test (NAME HL_FORTRAN_f90_tstds COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_tstds>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=hl_f90_tstds.txt" - #-D "TEST_REFERENCE=hl_f90_tstds.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) -endif () -set_tests_properties (HL_FORTRAN_f90_tstds PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects) - -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_tstlite COMMAND $<TARGET_FILE:hl_f90_tstlite>) -else () - add_test (NAME HL_FORTRAN_f90_tstlite COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_tstlite>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=hl_f90_tstlite.txt" - #-D "TEST_REFERENCE=hl_f90_tstlite.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) -endif () -set_tests_properties (HL_FORTRAN_f90_tstlite PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects) - -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_tstimage COMMAND $<TARGET_FILE:hl_f90_tstimage>) -else () - add_test (NAME HL_FORTRAN_f90_tstimage COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_tstimage>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=hl_f90_tstimage.txt" - #-D "TEST_REFERENCE=hl_f90_tstimage.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) -endif () -set_tests_properties (HL_FORTRAN_f90_tstimage PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects) - -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_tsttable COMMAND $<TARGET_FILE:hl_f90_tsttable>) -else () - add_test (NAME HL_FORTRAN_f90_tsttable COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_tsttable>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=hl_f90_tsttable.txt" - #-D "TEST_REFERENCE=hl_f90_tsttable.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) -endif () -set_tests_properties (HL_FORTRAN_f90_tsttable PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects) - if (BUILD_SHARED_LIBS) add_test ( NAME HL_FORTRAN_test-shared-clear-objects @@ -114,68 +85,8 @@ if (BUILD_SHARED_LIBS) set_tests_properties (HL_FORTRAN_test-shared-clear-objects PROPERTIES DEPENDS "HL_FORTRAN_f90_tsttable;HL_FORTRAN_f90_tstimage;HL_FORTRAN_f90_tstlite;HL_FORTRAN_f90_tstds" ) - - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_tstds-shared COMMAND $<TARGET_FILE:hl_f90_tstds-shared>) - else () - add_test (NAME HL_FORTRAN_f90_tstds-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_tstds-shared>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=hl_f90_tstds-shared.txt" - #-D "TEST_REFERENCE=hl_f90_tstds-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (HL_FORTRAN_f90_tstds-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects) - - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_tstlite-shared COMMAND $<TARGET_FILE:hl_f90_tstlite-shared>) - else () - add_test (NAME HL_FORTRAN_f90_tstlite-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_tstlite-shared>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=hl_f90_tstlite-shared.txt" - #-D "TEST_REFERENCE=hl_f90_tstlite-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (HL_FORTRAN_f90_tstlite-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects) - - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_tstimage-shared COMMAND $<TARGET_FILE:hl_f90_tstimage-shared>) - else () - add_test (NAME HL_FORTRAN_f90_tstimage-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_tstimage-shared>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=hl_f90_tstimage-shared.txt" - #-D "TEST_REFERENCE=hl_f90_tstimage-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (HL_FORTRAN_f90_tstimage-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects) - - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_tsttable-shared COMMAND $<TARGET_FILE:hl_f90_tsttable-shared>) - else () - add_test (NAME HL_FORTRAN_f90_tsttable-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:hl_f90_tsttable-shared>" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=hl_f90_tsttable-shared.txt" - #-D "TEST_REFERENCE=hl_f90_tsttable-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (HL_FORTRAN_f90_tsttable-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects) endif () + +foreach (test ${H5_TESTS}) + ADD_H5_FORTRAN_TEST(${test}) +endforeach () |