summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
Diffstat (limited to 'fortran')
-rw-r--r--fortran/examples/CMakeLists.txt145
-rw-r--r--fortran/examples/CMakeTests.cmake90
-rw-r--r--fortran/src/CMakeLists.txt248
-rw-r--r--fortran/test/CMakeLists.txt505
-rw-r--r--fortran/test/CMakeTests.cmake220
5 files changed, 435 insertions, 773 deletions
diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt
index 0c570c6..e8dddd3 100644
--- a/fortran/examples/CMakeLists.txt
+++ b/fortran/examples/CMakeLists.txt
@@ -35,56 +35,43 @@ set (F2003_examples
foreach (example ${examples})
add_executable (f90_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
- 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_property(TARGET f90_ex_${example} APPEND PROPERTY
# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
# )
# set_property(TARGET f90_ex_${example} APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:>
+# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
# )
if(MSVC)
set_property(TARGET f90_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
endif()
- set_target_properties (f90_ex_${example} PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER examples/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
- )
- if (BUILD_SHARED_LIBS)
- add_executable (f90_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
- target_include_directories (f90_ex_${example}-shared
+ if (NOT BUILD_SHARED_LIBS)
+ target_include_directories (f90_ex_${example}
PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ "${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}-shared
+ target_link_libraries (f90_ex_${example}
PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ ${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
)
- target_link_libraries (f90_ex_${example}-shared
+ else ()
+ target_include_directories (f90_ex_${example}
+ 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}
PRIVATE
${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}
)
-# set_property(TARGET f90_ex_${example}-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-# )
-# set_property(TARGET f90_ex_${example}-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-# )
- if(MSVC)
- set_property(TARGET f90_ex_${example}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- set_target_properties (f90_ex_${example}-shared PROPERTIES
+ set_target_properties (f90_ex_${example} PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER examples/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
@@ -94,18 +81,10 @@ endforeach ()
foreach (example ${F2003_examples})
add_executable (f03_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
- 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_link_libraries (f03_ex_${example}
- PRIVATE
- ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}
- )
# set_property(TARGET f03_ex_${example} APPEND PROPERTY
# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
# )
@@ -115,35 +94,30 @@ foreach (example ${F2003_examples})
if(MSVC)
set_property(TARGET f03_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
endif()
- set_target_properties (f03_ex_${example} PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER examples/fortran03
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
- )
- if (BUILD_SHARED_LIBS)
- add_executable (f03_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
- target_include_directories (f03_ex_${example}-shared
+ if (NOT ONLY_SHARED_LIBS)
+ target_include_directories (f03_ex_${example}
PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ "${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}-shared
+ target_link_libraries (f03_ex_${example}
PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}
)
- target_link_libraries (f03_ex_${example}-shared
+ set_target_properties (f03_ex_${example} PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER examples/fortran03
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ )
+ else ()
+ target_include_directories (f03_ex_${example}
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ )
+ target_link_libraries (f03_ex_${example}
PRIVATE
${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}
)
-# set_property(TARGET f03_ex_${example}-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-# )
-# set_property(TARGET f03_ex_${example}-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-# )
- if(MSVC)
- set_property(TARGET f03_ex_${example}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- set_target_properties (f03_ex_${example}-shared PROPERTIES
+ set_target_properties (f03_ex_${example} PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER examples/fortran03
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
@@ -153,19 +127,10 @@ endforeach ()
if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
add_executable (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90)
- 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;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>"
- )
target_compile_options(f90_ex_ph5example
PRIVATE
$<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
- target_link_libraries (f90_ex_ph5example
- PRIVATE
- ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}
- $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}>
- )
# set_property(TARGET f90_ex_ph5example APPEND PROPERTY
# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
# )
@@ -175,36 +140,32 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
if(MSVC)
set_property(TARGET f90_ex_ph5example PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
endif()
- set_target_properties (f90_ex_ph5example PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER examples/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
- )
- if (BUILD_SHARED_LIBS)
- add_executable (f90_ex_ph5example-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90)
- target_include_directories (f90_ex_ph5example-shared
+ if (NOT ONLY_SHARED_LIBS)
+ target_include_directories (f90_ex_ph5example
PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>"
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>"
)
- target_compile_options(f90_ex_ph5example-shared
+ target_link_libraries (f90_ex_ph5example
PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET}
+ $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}>
+ )
+ set_target_properties (f90_ex_ph5example PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER examples/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ )
+ else ()
+ target_include_directories (f90_ex_ph5example
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>"
)
- target_link_libraries (f90_ex_ph5example-shared
+ target_link_libraries (f90_ex_ph5example
PRIVATE
${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}
$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}>
)
-# set_property(TARGET f90_ex_ph5example-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-# )
-# set_property(TARGET f90_ex_ph5example-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-# )
- if(MSVC)
- set_property(TARGET f90_ex_ph5example-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- set_target_properties (f90_ex_ph5example-shared PROPERTIES
+ set_target_properties (f90_ex_ph5example PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER examples/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake
index efbb209..1ad606c 100644
--- a/fortran/examples/CMakeTests.cmake
+++ b/fortran/examples/CMakeTests.cmake
@@ -16,36 +16,7 @@
##############################################################################
##############################################################################
- # Remove any output file left over from previous test run
- add_test (
- NAME f90_ex-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- compound.h5
- copy1.h5
- copy2.h5
- dsetf.h5
- extend.h5
- FORTRAN.h5
- groupf.h5
- groupsf.h5
- h5_cmprss.h5
- mount1.h5
- mount2.h5
- sdsf.h5
- subset.h5
- SDScompound.h5
- test.h5
- )
- if (last_test)
- set_tests_properties (f90_ex-clear-objects PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "f90_ex-clear-objects")
- if (BUILD_SHARED_LIBS)
- add_test (
- NAME f90_ex-shared-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
+ set (test_CLEANFILES
compound.h5
copy1.h5
copy2.h5
@@ -61,12 +32,18 @@
subset.h5
SDScompound.h5
test.h5
- )
- if (last_test)
- set_tests_properties (f90_ex-shared-clear-objects PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "f90_ex-shared-clear-objects")
+ )
+
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME f90_ex-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove ${test_CLEANFILES}
+ )
+ if (last_test)
+ set_tests_properties (f90_ex-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
+ set (last_test "f90_ex-clear-objects")
foreach (example ${examples})
if (HDF5_ENABLE_USING_MEMCHECKER)
@@ -87,26 +64,6 @@ foreach (example ${examples})
set_tests_properties (f90_ex_${example} PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "f90_ex_${example}")
- if (BUILD_SHARED_LIBS)
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME f90_ex-shared_${example} COMMAND $<TARGET_FILE:f90_ex_${example}-shared>)
- else ()
- add_test (NAME f90_ex-shared_${example} COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:f90_ex_${example}-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=f90_ex_${example}-shared.txt"
- #-D "TEST_REFERENCE=f90_ex_${example}-shared.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
- if (last_test)
- set_tests_properties (f90_ex-shared_${example} PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "f90_ex-shared_${example}")
- endif ()
endforeach ()
foreach (example ${F2003_examples})
@@ -128,31 +85,8 @@ foreach (example ${F2003_examples})
set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test})
endif ()
set (last_test "f03_ex_${example}")
- if (BUILD_SHARED_LIBS)
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME f03_ex-shared_${example} COMMAND $<TARGET_FILE:f03_ex_${example}-shared>)
- else ()
- add_test (NAME f03_ex-shared_${example} COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:f03_ex_${example}-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=f03_ex_${example}-shared.txt"
- #-D "TEST_REFERENCE=f03_ex_${example}-shared.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
- if (last_test)
- set_tests_properties (f03_ex-shared_${example} PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "f03_ex-shared_${example}")
- endif ()
endforeach ()
if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
add_test (NAME MPI_TEST_f90_ex_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:f90_ex_ph5example> ${MPIEXEC_POSTFLAGS})
- if (BUILD_SHARED_LIBS)
- add_test (NAME MPI_TEST_f90_ex-shared_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:f90_ex_ph5example> ${MPIEXEC_POSTFLAGS})
- endif ()
endif ()
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt
index 83ee82c..32c38ba 100644
--- a/fortran/src/CMakeLists.txt
+++ b/fortran/src/CMakeLists.txt
@@ -40,7 +40,7 @@ set (Fortran_COMPILER_ID CMAKE_Fortran_COMPILER_ID)
#-----------------------------------------------------------------------------
add_executable (H5_buildiface ${HDF5_F90_SRC_SOURCE_DIR}/H5_buildiface.F90)
-target_include_directories(H5_buildiface
+target_include_directories (H5_buildiface
PRIVATE
"${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}"
)
@@ -69,24 +69,28 @@ if (BUILD_SHARED_LIBS)
file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/shared")
set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF_CFG_BUILD_TYPE})
endif ()
-file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static")
-set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE})
+if (NOT ONLY_SHARED_LIBS)
+ file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static")
+ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE})
+endif ()
#-----------------------------------------------------------------------------
add_executable (H5match_types
${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h
${HDF5_F90_SRC_SOURCE_DIR}/H5match_types.c
)
-target_include_directories(H5match_types PRIVATE "${HDF5_BINARY_DIR};${HDF5_SRC_DIR};${HDF5_F90_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-add_custom_command (
- OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h
- ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90
- COMMAND $<TARGET_FILE:H5match_types>
- WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static
- DEPENDS H5match_types
-)
-set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h PROPERTIES GENERATED TRUE)
-set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 PROPERTIES GENERATED TRUE)
+target_include_directories (H5match_types PRIVATE "${HDF5_BINARY_DIR};${HDF5_SRC_DIR};${HDF5_F90_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT ONLY_SHARED_LIBS)
+ add_custom_command (
+ OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h
+ ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90
+ COMMAND $<TARGET_FILE:H5match_types>
+ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static
+ DEPENDS H5match_types
+ )
+ set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h PROPERTIES GENERATED TRUE)
+ set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90 PROPERTIES GENERATED TRUE)
+endif ()
if (BUILD_SHARED_LIBS)
add_custom_command (
OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h
@@ -131,24 +135,26 @@ set (f90CStub_C_SHHDRS
${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h
)
-add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS})
-target_include_directories(${HDF5_F90_C_LIB_TARGET}
- PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
- INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
-TARGET_C_PROPERTIES (${HDF5_F90_C_LIB_TARGET} STATIC)
-target_link_libraries (${HDF5_F90_C_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET})
-set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIB_TARGET}")
-H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIB_TARGET} ${HDF5_F90_C_LIB_NAME} STATIC 0)
-set_target_properties (${HDF5_F90_C_LIB_TARGET} PROPERTIES
- FOLDER libraries/fortran
- LINKER_LANGUAGE C
-)
-set (install_targets ${HDF5_F90_C_LIB_TARGET})
+if (NOT ONLY_SHARED_LIBS)
+ add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS})
+ target_include_directories (${HDF5_F90_C_LIB_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ TARGET_C_PROPERTIES (${HDF5_F90_C_LIB_TARGET} STATIC)
+ target_link_libraries (${HDF5_F90_C_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET})
+ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIB_TARGET}")
+ H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIB_TARGET} ${HDF5_F90_C_LIB_NAME} STATIC 0)
+ set_target_properties (${HDF5_F90_C_LIB_TARGET} PROPERTIES
+ FOLDER libraries/fortran
+ LINKER_LANGUAGE C
+ )
+ set (install_targets ${HDF5_F90_C_LIB_TARGET})
+endif ()
if (BUILD_SHARED_LIBS)
add_library (${HDF5_F90_C_LIBSH_TARGET} SHARED ${f90CStub_C_SOURCES} ${f90CStub_C_SHHDRS})
- target_include_directories(${HDF5_F90_C_LIBSH_TARGET}
+ target_include_directories (${HDF5_F90_C_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
@@ -174,17 +180,19 @@ set (f90_F_GEN_SOURCES
${HDF5_F90_SRC_SOURCE_DIR}/H5Dff.F90
${HDF5_F90_SRC_SOURCE_DIR}/H5Pff.F90
)
-add_custom_command (
- OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90
- COMMAND $<TARGET_FILE:H5_buildiface>
- WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static
- DEPENDS ${f90_F_GEN_SOURCES}
- COMMENT "Generating the H5_gen.F90 file"
-)
-add_custom_target (H5gen ALL
- DEPENDS ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90
-)
-set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 PROPERTIES GENERATED TRUE)
+if (NOT ONLY_SHARED_LIBS)
+ add_custom_command (
+ OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90
+ COMMAND $<TARGET_FILE:H5_buildiface>
+ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static
+ DEPENDS ${f90_F_GEN_SOURCES}
+ COMMENT "Generating the H5_gen.F90 file"
+ )
+ add_custom_target (H5gen ALL
+ DEPENDS ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90
+ )
+ set_source_files_properties (${HDF5_F90_BINARY_DIR}/static/H5_gen.F90 PROPERTIES GENERATED TRUE)
+endif ()
if (BUILD_SHARED_LIBS)
add_custom_command (
@@ -221,18 +229,20 @@ set (f90_F_BASE_SOURCES
${HDF5_F90_SRC_SOURCE_DIR}/H5Zff.F90
)
-set (f90_F_SOURCES
- # generated file
- ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90
+if (NOT ONLY_SHARED_LIBS)
+ set (f90_F_SOURCES
+ # generated file
+ ${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90
- ${f90_F_BASE_SOURCES}
+ ${f90_F_BASE_SOURCES}
- # generated file
- ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90
+ # generated file
+ ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90
- # normal distribution
- ${HDF5_F90_SRC_SOURCE_DIR}/HDF5.F90
-)
+ # normal distribution
+ ${HDF5_F90_SRC_SOURCE_DIR}/HDF5.F90
+ )
+endif ()
if (BUILD_SHARED_LIBS)
set (f90_F_SOURCES_SHARED
# generated file
@@ -251,43 +261,45 @@ endif ()
#-----------------------------------------------------------------------------
# Add Main fortran library
#-----------------------------------------------------------------------------
-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>"
-)
-target_compile_definitions(${HDF5_F90_LIB_TARGET}
- PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:HDF5F90_WINDOWS>
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
-)
-target_link_libraries (${HDF5_F90_LIB_TARGET}
- PUBLIC
- ${HDF5_F90_C_LIB_TARGET}
- PRIVATE
- ${LINK_Fortran_LIBS}
- $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}>
-)
-#set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-#)
-#set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-#)
-if(MSVC)
- set_property(TARGET ${HDF5_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
-endif()
-set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES
- FOLDER libraries/fortran
- LINKER_LANGUAGE Fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
-)
-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 (NOT ONLY_SHARED_LIBS)
+ 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>"
+ )
+ target_compile_definitions(${HDF5_F90_LIB_TARGET}
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:HDF5F90_WINDOWS>
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ )
+ target_link_libraries (${HDF5_F90_LIB_TARGET}
+ PUBLIC
+ ${HDF5_F90_C_LIB_TARGET}
+ PRIVATE
+ ${LINK_Fortran_LIBS}
+ $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}>
+ )
+# set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY
+# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
+# )
+# set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY
+# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
+# )
+ if(MSVC)
+ set_property(TARGET ${HDF5_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
+ endif()
+ set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES
+ FOLDER libraries/fortran
+ LINKER_LANGUAGE Fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ )
+ 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)
+endif ()
if (BUILD_SHARED_LIBS)
add_library (${HDF5_F90_LIBSH_TARGET} SHARED ${f90_F_SOURCES_SHARED})
@@ -352,35 +364,37 @@ install (
fortheaders
)
-set (mod_files
- ${MOD_BUILD_DIR}/h5fortran_types.mod
- ${MOD_BUILD_DIR}/hdf5.mod
- ${MOD_BUILD_DIR}/h5fortkit.mod
- ${MOD_BUILD_DIR}/h5global.mod
- ${MOD_BUILD_DIR}/h5a.mod
- ${MOD_BUILD_DIR}/h5d.mod
- ${MOD_BUILD_DIR}/h5e.mod
- ${MOD_BUILD_DIR}/h5f.mod
- ${MOD_BUILD_DIR}/h5g.mod
- ${MOD_BUILD_DIR}/h5i.mod
- ${MOD_BUILD_DIR}/h5l.mod
- ${MOD_BUILD_DIR}/h5lib.mod
- ${MOD_BUILD_DIR}/h5o.mod
- ${MOD_BUILD_DIR}/h5p.mod
- ${MOD_BUILD_DIR}/h5r.mod
- ${MOD_BUILD_DIR}/h5s.mod
- ${MOD_BUILD_DIR}/h5t.mod
- ${MOD_BUILD_DIR}/h5z.mod
- ${MOD_BUILD_DIR}/h5_gen.mod
-)
-install (
- FILES
- ${mod_files}
- DESTINATION
- ${HDF5_INSTALL_INCLUDE_DIR}/static
- COMPONENT
- fortheaders
-)
+if (NOT ONLY_SHARED_LIBS)
+ set (mod_files
+ ${MOD_BUILD_DIR}/h5fortran_types.mod
+ ${MOD_BUILD_DIR}/hdf5.mod
+ ${MOD_BUILD_DIR}/h5fortkit.mod
+ ${MOD_BUILD_DIR}/h5global.mod
+ ${MOD_BUILD_DIR}/h5a.mod
+ ${MOD_BUILD_DIR}/h5d.mod
+ ${MOD_BUILD_DIR}/h5e.mod
+ ${MOD_BUILD_DIR}/h5f.mod
+ ${MOD_BUILD_DIR}/h5g.mod
+ ${MOD_BUILD_DIR}/h5i.mod
+ ${MOD_BUILD_DIR}/h5l.mod
+ ${MOD_BUILD_DIR}/h5lib.mod
+ ${MOD_BUILD_DIR}/h5o.mod
+ ${MOD_BUILD_DIR}/h5p.mod
+ ${MOD_BUILD_DIR}/h5r.mod
+ ${MOD_BUILD_DIR}/h5s.mod
+ ${MOD_BUILD_DIR}/h5t.mod
+ ${MOD_BUILD_DIR}/h5z.mod
+ ${MOD_BUILD_DIR}/h5_gen.mod
+ )
+ install (
+ FILES
+ ${mod_files}
+ DESTINATION
+ ${HDF5_INSTALL_INCLUDE_DIR}/static
+ COMPONENT
+ fortheaders
+ )
+endif ()
if (BUILD_SHARED_LIBS)
set (modsh_files
@@ -422,8 +436,10 @@ if (HDF5_EXPORTED_TARGETS)
INSTALL_TARGET_PDB (${HDF5_F90_C_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries)
#INSTALL_TARGET_PDB (${HDF5_F90_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries)
endif ()
- INSTALL_TARGET_PDB (${HDF5_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries)
- #INSTALL_TARGET_PDB (${HDF5_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries)
+ if (NOT ONLY_SHARED_LIBS)
+ INSTALL_TARGET_PDB (${HDF5_F90_C_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries)
+ #INSTALL_TARGET_PDB (${HDF5_F90_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} fortlibraries)
+ endif ()
install (
TARGETS
diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt
index c5a47c0..3f049af 100644
--- a/fortran/test/CMakeLists.txt
+++ b/fortran/test/CMakeLists.txt
@@ -7,7 +7,7 @@ project (HDF5_FORTRAN_TESTS C Fortran)
#-----------------------------------------------------------------------------
add_executable (H5_test_buildiface ${HDF5_F90_SRC_DIR}/test/H5_test_buildiface.F90)
-target_include_directories(H5_test_buildiface
+target_include_directories (H5_test_buildiface
PRIVATE
${HDF5_BINARY_DIR} ${HDF5_F90_BINARY_DIR}
)
@@ -35,31 +35,34 @@ if (BUILD_SHARED_LIBS)
file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared")
set (MODSH_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/shared/${HDF_CFG_BUILD_TYPE})
endif ()
-file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/static")
-set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE})
+if (NOT ONLY_SHARED_LIBS)
+ file (MAKE_DIRECTORY "${HDF5_FORTRAN_TESTS_BINARY_DIR}/static")
+ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE})
+endif ()
#-----------------------------------------------------------------------------
# Add Test Lib
#-----------------------------------------------------------------------------
-add_library (${HDF5_F90_C_TEST_LIB_TARGET} STATIC t.c)
-set_source_files_properties (t.c PROPERTIES LANGUAGE C)
-target_include_directories(${HDF5_F90_C_TEST_LIB_TARGET}
- PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
- INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
-TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} STATIC)
-target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} PRIVATE
- ${HDF5_F90_C_LIB_TARGET}
- ${HDF5_TEST_LIB_TARGET}
-)
-H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} STATIC 0)
-set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES
- FOLDER libraries/test/fortran
- LINKER_LANGUAGE C
-)
-if (BUILD_SHARED_LIBS)
+if (NOT BUILD_SHARED_LIBS)
+ add_library (${HDF5_F90_C_TEST_LIB_TARGET} STATIC t.c)
+ set_source_files_properties (t.c PROPERTIES LANGUAGE C)
+ target_include_directories (${HDF5_F90_C_TEST_LIB_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} STATIC)
+ target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} PRIVATE
+ ${HDF5_F90_C_LIB_TARGET}
+ ${HDF5_TEST_LIB_TARGET}
+ )
+ H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} STATIC 0)
+ set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES
+ FOLDER libraries/test/fortran
+ LINKER_LANGUAGE C
+ )
+else ()
add_library (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED t.c)
- target_include_directories(${HDF5_F90_C_TEST_LIBSH_TARGET}
+ target_include_directories (${HDF5_F90_C_TEST_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared;$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
@@ -78,19 +81,19 @@ if (BUILD_SHARED_LIBS)
)
endif ()
-add_custom_command (
- OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90
- COMMAND $<TARGET_FILE:H5_test_buildiface>
- WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static
- DEPENDS H5_test_buildiface
- COMMENT "Generating the tf_gen.F90 file"
-)
-add_custom_target (H5testgen ALL
- DEPENDS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90
-)
-set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 PROPERTIES GENERATED TRUE)
-
-if (BUILD_SHARED_LIBS)
+if (NOT BUILD_SHARED_LIBS)
+ add_custom_command (
+ OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90
+ COMMAND $<TARGET_FILE:H5_test_buildiface>
+ WORKING_DIRECTORY ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static
+ DEPENDS H5_test_buildiface
+ COMMENT "Generating the tf_gen.F90 file"
+ )
+ add_custom_target (H5testgen ALL
+ DEPENDS ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90
+ )
+ set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90 PROPERTIES GENERATED TRUE)
+else ()
add_custom_command (
OUTPUT ${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90
COMMAND $<TARGET_FILE:H5_test_buildiface>
@@ -104,15 +107,16 @@ if (BUILD_SHARED_LIBS)
set_source_files_properties (${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90 PROPERTIES GENERATED TRUE)
endif ()
-set (HDF5_F90_TF_SOURCES
- # generated files
- ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90
+if (NOT BUILD_SHARED_LIBS)
+ set (HDF5_F90_TF_SOURCES
+ # generated files
+ ${HDF5_FORTRAN_TESTS_BINARY_DIR}/static/tf_gen.F90
- # normal distribution
- tf.F90
-)
-set_source_files_properties (${HDF5_F90_TF_SOURCES} PROPERTIES LANGUAGE Fortran)
-if (BUILD_SHARED_LIBS)
+ # normal distribution
+ tf.F90
+ )
+ set_source_files_properties (${HDF5_F90_TF_SOURCES} PROPERTIES LANGUAGE Fortran)
+else ()
set (HDF5_F90_TF_SOURCES_SHARED
# generated file
${HDF5_FORTRAN_TESTS_BINARY_DIR}/shared/tf_gen.F90
@@ -123,40 +127,40 @@ if (BUILD_SHARED_LIBS)
set_source_files_properties (${HDF5_F90_TF_SOURCES_SHARED} PROPERTIES LANGUAGE Fortran)
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>"
-)
-target_compile_definitions(${HDF5_F90_TEST_LIB_TARGET}
- PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:HDF5F90_WINDOWS>
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
-)
-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 PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-#)
-#set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-#)
-if(MSVC)
- set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
-endif()
-set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES
- FOLDER libraries/test/fortran
- LINKER_LANGUAGE Fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
-)
-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)
+if (NOT BUILD_SHARED_LIBS)
+ 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>"
+ )
+ target_compile_definitions(${HDF5_F90_TEST_LIB_TARGET}
+ PRIVATE
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:HDF5F90_WINDOWS>
+ $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ )
+ 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 PROPERTY
+# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
+# )
+# set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY
+# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
+# )
+ if(MSVC)
+ set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
+ endif()
+ set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES
+ FOLDER libraries/test/fortran
+ LINKER_LANGUAGE Fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ )
+ H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} STATIC 0)
+ add_dependencies(${HDF5_F90_TEST_LIB_TARGET} H5testgen)
+else ()
add_library (${HDF5_F90_TEST_LIBSH_TARGET} SHARED ${HDF5_F90_TF_SOURCES_SHARED})
target_include_directories (${HDF5_F90_TEST_LIBSH_TARGET}
PRIVATE
@@ -218,18 +222,10 @@ 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_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_property(TARGET testhdf5_fortran APPEND PROPERTY
# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
#)
@@ -239,58 +235,36 @@ target_link_libraries (testhdf5_fortran
if(MSVC)
set_property(TARGET testhdf5_fortran PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
endif()
-set_target_properties (testhdf5_fortran PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER test/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
-)
-add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET})
-
-if (BUILD_SHARED_LIBS)
- add_executable (testhdf5_fortran-shared
- fortranlib_test.F90
- tH5A.F90
- tH5D.F90
- tH5E.F90
- tH5F.F90
- tH5G.F90
- tH5I.F90
- tH5P.F90
- tH5R.F90
- tH5S.F90
- tH5Sselect.F90
- tH5T.F90
- tH5VL.F90
- tH5Z.F90
- tHDF5.F90
- )
- target_include_directories (testhdf5_fortran-shared
+if (NOT BUILD_SHARED_LIBS)
+ target_include_directories (testhdf5_fortran
PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
)
- target_compile_options(testhdf5_fortran-shared
+ target_link_libraries (testhdf5_fortran
PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ ${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
)
- target_link_libraries (testhdf5_fortran-shared
+ add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET})
+else ()
+ target_include_directories (testhdf5_fortran
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ )
+ target_link_libraries (testhdf5_fortran
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 PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-# )
-# set_property(TARGET testhdf5_fortran-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-# )
- if(MSVC)
- set_property(TARGET testhdf5_fortran-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- set_target_properties (testhdf5_fortran-shared PROPERTIES
+ set_target_properties (testhdf5_fortran PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
)
- add_dependencies (testhdf5_fortran-shared ${HDF5_F90_TEST_LIBSH_TARGET})
+ add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIBSH_TARGET})
endif ()
#-- Adding test for testhdf5_fortran_1_8
@@ -302,18 +276,10 @@ 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_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_property(TARGET testhdf5_fortran_1_8 APPEND PROPERTY
# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
#)
@@ -323,49 +289,36 @@ target_link_libraries (testhdf5_fortran_1_8
if(MSVC)
set_property(TARGET testhdf5_fortran_1_8 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
endif()
-set_target_properties (testhdf5_fortran_1_8 PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER test/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
-)
-add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET})
-
-if (BUILD_SHARED_LIBS)
- add_executable (testhdf5_fortran_1_8-shared
- fortranlib_test_1_8.F90
- tH5O.F90
- tH5A_1_8.F90
- tH5G_1_8.F90
- tH5MISC_1_8.F90
- tHDF5_1_8.F90
- )
- target_include_directories (testhdf5_fortran_1_8-shared
+if (NOT BUILD_SHARED_LIBS)
+ target_include_directories (testhdf5_fortran_1_8
PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
)
- target_compile_options(testhdf5_fortran_1_8-shared
+ target_link_libraries (testhdf5_fortran_1_8
PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ ${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
+ )
+ add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET})
+else ()
+ target_include_directories (testhdf5_fortran_1_8
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
)
- target_link_libraries (testhdf5_fortran_1_8-shared
+ target_link_libraries (testhdf5_fortran_1_8
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 PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-# )
-# set_property(TARGET testhdf5_fortran_1_8-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-# )
- if(MSVC)
- set_property(TARGET testhdf5_fortran_1_8-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- set_target_properties (testhdf5_fortran_1_8-shared PROPERTIES
+ set_target_properties (testhdf5_fortran_1_8 PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
)
- add_dependencies (testhdf5_fortran_1_8-shared ${HDF5_F90_TEST_LIBSH_TARGET})
+ add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIBSH_TARGET})
endif ()
#-- Adding test for fortranlib_test_F03
@@ -379,18 +332,10 @@ 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_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_property(TARGET fortranlib_test_F03 APPEND PROPERTY
# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
#)
@@ -400,67 +345,44 @@ target_link_libraries (fortranlib_test_F03
if(MSVC)
set_property(TARGET fortranlib_test_F03 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
endif()
-set_target_properties (fortranlib_test_F03 PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER test/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
-)
-add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET})
-
-if (BUILD_SHARED_LIBS)
- add_executable (fortranlib_test_F03-shared
- fortranlib_test_F03.F90
- tH5E_F03.F90
- tH5F_F03.F90
- tH5L_F03.F90
- tH5O_F03.F90
- tH5P_F03.F90
- tH5T_F03.F90
- tHDF5_F03.F90
- )
- target_include_directories (fortranlib_test_F03-shared
+if (NOT BUILD_SHARED_LIBS)
+ target_include_directories (fortranlib_test_F03
PRIVATE
- "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static"
)
- target_compile_options(fortranlib_test_F03-shared
+ target_link_libraries (fortranlib_test_F03
PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ ${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
+ )
+ add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET})
+else ()
+ target_include_directories (fortranlib_test_F03
+ PRIVATE
+ "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared"
)
- target_link_libraries (fortranlib_test_F03-shared
+ target_link_libraries (fortranlib_test_F03
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 PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-# )
-# set_property(TARGET fortranlib_test_F03-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-# )
- if(MSVC)
- set_property(TARGET fortranlib_test_F03-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- set_target_properties (fortranlib_test_F03-shared PROPERTIES
+ set_target_properties (fortranlib_test_F03 PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
)
- add_dependencies (fortranlib_test_F03-shared ${HDF5_F90_TEST_LIBSH_TARGET})
+ add_dependencies (fortranlib_test_F03 ${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_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_property(TARGET fflush1 APPEND PROPERTY
# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
#)
@@ -470,58 +392,44 @@ target_link_libraries (fflush1
if(MSVC)
set_property(TARGET fflush1 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
endif()
-set_target_properties (fflush1 PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER test/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
-)
-add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET})
-
-if (BUILD_SHARED_LIBS)
- add_executable (fflush1-shared fflush1.F90)
- target_include_directories (fflush1-shared
+if (NOT BUILD_SHARED_LIBS)
+ target_include_directories (fflush1
PRIVATE
- ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ ${CMAKE_Fortran_MODULE_DIRECTORY}/static
)
- target_compile_options(fflush1-shared
+ target_link_libraries (fflush1
PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ ${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
)
- target_link_libraries (fflush1-shared
+ add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET})
+else ()
+ target_include_directories (fflush1
+ PRIVATE
+ ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ )
+ target_link_libraries (fflush1
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 PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-# )
-# set_property(TARGET fflush1-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-# )
- if(MSVC)
- set_property(TARGET fflush1-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- set_target_properties (fflush1-shared PROPERTIES
+ set_target_properties (fflush1 PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
)
- add_dependencies (fflush1-shared ${HDF5_F90_TEST_LIBSH_TARGET})
+ add_dependencies (fflush1 ${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_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_property(TARGET fflush2 APPEND PROPERTY
# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
#)
@@ -531,60 +439,44 @@ target_link_libraries (fflush2
if(MSVC)
set_property(TARGET fflush2 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
endif()
-set_target_properties (fflush2 PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER test/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
-)
-add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET})
-
-if (BUILD_SHARED_LIBS)
- add_executable (fflush2-shared fflush2.F90)
- target_include_directories (fflush2-shared
+if (NOT BUILD_SHARED_LIBS)
+ target_include_directories (fflush2
PRIVATE
- ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ ${CMAKE_Fortran_MODULE_DIRECTORY}/static
)
- target_compile_options(fflush2-shared
+ target_link_libraries (fflush2
PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ ${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
+ )
+ add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET})
+else ()
+ target_include_directories (fflush2
+ PRIVATE
+ ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
)
- target_link_libraries (fflush2-shared
+ target_link_libraries (fflush2
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 PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-# )
-# set_property(TARGET fflush2-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-# )
- if(MSVC)
- set_property(TARGET fflush2-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- set_target_properties (fflush2-shared PROPERTIES
+ set_target_properties (fflush2 PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
)
- add_dependencies (fflush2-shared ${HDF5_F90_TEST_LIBSH_TARGET})
+ add_dependencies (fflush2 ${HDF5_F90_TEST_LIBSH_TARGET})
endif ()
#-- Adding test for vol_connector
-add_executable (vol_connector
- vol_connector.F90)
-
-target_include_directories (vol_connector
- PRIVATE
- ${CMAKE_Fortran_MODULE_DIRECTORY}/static
-)
+add_executable (vol_connector vol_connector.F90)
target_compile_options(vol_connector
PRIVATE
$<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
)
-target_link_libraries (vol_connector
- PRIVATE
- ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
-)
#set_property(TARGET vol_connector APPEND PROPERTY
# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
#)
@@ -594,43 +486,36 @@ target_link_libraries (vol_connector
if(MSVC)
set_property(TARGET vol_connector PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
endif()
-set_target_properties (vol_connector PROPERTIES
- LINKER_LANGUAGE Fortran
- FOLDER test/fortran
- Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
-)
-add_dependencies (vol_connector ${HDF5_F90_TEST_LIB_TARGET})
-
-if (BUILD_SHARED_LIBS)
- add_executable (vol_connector-shared
- vol_connector.F90)
- target_include_directories (vol_connector-shared
+if (NOT BUILD_SHARED_LIBS)
+ target_include_directories (vol_connector
PRIVATE
- ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ ${CMAKE_Fortran_MODULE_DIRECTORY}/static
)
- target_compile_options(vol_connector-shared
+ target_link_libraries (vol_connector
PRIVATE
- $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}>
+ ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
- target_link_libraries (vol_connector-shared
+ set_target_properties (vol_connector PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER test/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static
+ )
+ add_dependencies (vol_connector ${HDF5_F90_TEST_LIB_TARGET})
+else ()
+ target_include_directories (vol_connector
+ PRIVATE
+ ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
+ )
+ target_link_libraries (vol_connector
PRIVATE
${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$<PLATFORM_ID:Windows>:ws2_32.lib>
)
-# set_property(TARGET vol_connector-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE">
-# )
-# set_property(TARGET vol_connector-shared APPEND PROPERTY
-# LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_LINK_FLAGS}>
-# )
- if(MSVC)
- set_property(TARGET vol_connector-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}")
- endif()
- set_target_properties (vol_connector-shared PROPERTIES
+ set_target_properties (vol_connector PROPERTIES
LINKER_LANGUAGE Fortran
FOLDER test/fortran
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared
)
- add_dependencies (vol_connector-shared ${HDF5_F90_TEST_LIBSH_TARGET})
+ add_dependencies (vol_connector ${HDF5_F90_TEST_LIBSH_TARGET})
endif ()
include (CMakeTests.cmake)
diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake
index a63a201..20fb7e3 100644
--- a/fortran/test/CMakeTests.cmake
+++ b/fortran/test/CMakeTests.cmake
@@ -15,48 +15,49 @@
### T E S T I N G ###
##############################################################################
##############################################################################
-if (BUILD_SHARED_LIBS)
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/fshared")
-endif ()
+
+set (test_CLEANFILES
+ a.h5
+ b.h5
+ c.h5
+ d.h5
+ dsetf_F03.h5
+ enum1.h5
+ extern_1a.raw
+ extern_2a.raw
+ extern_3a.raw
+ extern_4a.raw
+ extren_raw.raw
+ get_info.h5
+ nbit.h5
+ t_array_F03.h5
+ t_bit_F03.h5
+ t_controlchar_F03.h5
+ t_enum_F03.h5
+ t_objref_F03.h5
+ t_opaque_F03.h5
+ t_regref_F03.h5
+ t_string_F03.h5
+ t_vlen_F03.h5
+ t_vlstring_F03.h5
+ t_vlstringrw_F03.h5
+ tarray1.h5
+ tarray2.h5
+ tarray3.h5
+ test_create.h5
+ tget_file_image.h5
+ th5o_ref.h5
+ titerate.h5
+ vds.h5
+ visit.h5
+)
# Remove any output file left over from previous test run
add_test (
NAME FORTRAN_testhdf5-clear-objects
COMMAND ${CMAKE_COMMAND}
-E remove
- a.h5
- b.h5
- c.h5
- d.h5
- dsetf_F03.h5
- enum1.h5
- extern_1a.raw
- extern_2a.raw
- extern_3a.raw
- extern_4a.raw
- extren_raw.raw
- get_info.h5
- nbit.h5
- t_array_F03.h5
- t_bit_F03.h5
- t_controlchar_F03.h5
- t_enum_F03.h5
- t_objref_F03.h5
- t_opaque_F03.h5
- t_regref_F03.h5
- t_string_F03.h5
- t_vlen_F03.h5
- t_vlstring_F03.h5
- t_vlstringrw_F03.h5
- tarray1.h5
- tarray2.h5
- tarray3.h5
- test_create.h5
- tget_file_image.h5
- th5o_ref.h5
- titerate.h5
- vds.h5
- visit.h5
+ ${test_CLEANFILES}
)
if (last_test)
set_tests_properties (FORTRAN_testhdf5-clear-objects PROPERTIES DEPENDS ${last_test})
@@ -122,14 +123,6 @@ endif ()
# set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s")
set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES DEPENDS FORTRAN_testhdf5_fortran_1_8)
-#-- Adding test for fflush1
-add_test (NAME FORTRAN_fflush1 COMMAND $<TARGET_FILE:fflush1>)
-set_tests_properties (FORTRAN_fflush1 PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects)
-
-#-- Adding test for fflush2
-add_test (NAME FORTRAN_fflush2 COMMAND $<TARGET_FILE:fflush2>)
-set_tests_properties (FORTRAN_fflush2 PROPERTIES DEPENDS FORTRAN_fflush1)
-
#-- Adding test for vol_connector
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (NAME FORTRAN_vol_connector COMMAND $<TARGET_FILE:vol_connector>)
@@ -147,138 +140,11 @@ else ()
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
-# set_tests_properties (FORTRAN_vol_connector PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s")
- set_tests_properties (FORTRAN_vol_connector PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects)
-if (BUILD_SHARED_LIBS)
- add_test (
- NAME FORTRAN_testhdf5-shared-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- a.h5
- b.h5
- c.h5
- d.h5
- dsetf_F03.h5
- enum1.h5
- extern_1a.raw
- extern_2a.raw
- extern_3a.raw
- extern_4a.raw
- extren_raw.raw
- get_info.h5
- nbit.h5
- t_array_F03.h5
- t_bit_F03.h5
- t_controlchar_F03.h5
- t_enum_F03.h5
- t_objref_F03.h5
- t_opaque_F03.h5
- t_regref_F03.h5
- t_string_F03.h5
- t_vlen_F03.h5
- t_vlstring_F03.h5
- t_vlstringrw_F03.h5
- tarray1.h5
- tarray2.h5
- tarray3.h5
- test_create.h5
- tget_file_image.h5
- th5o_ref.h5
- titerate.h5
- vds.h5
- visit.h5
- WORKING_DIRECTORY
- ${PROJECT_BINARY_DIR}/fshared
- )
- set_tests_properties (FORTRAN_testhdf5-shared-clear-objects PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects)
-
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME FORTRAN_testhdf5_fortran-shared COMMAND $<TARGET_FILE:testhdf5_fortran-shared>)
- else ()
- add_test (NAME FORTRAN_testhdf5_fortran-shared COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:testhdf5_fortran-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_REGEX= 0 error.s."
- -D "TEST_MATCH= 0 error(s)"
- -D "TEST_OUTPUT=testhdf5_fortran.txt"
- #-D "TEST_REFERENCE=testhdf5_fortran.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
-# set_tests_properties (FORTRAN_testhdf5_fortran-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s")
- set_tests_properties (FORTRAN_testhdf5_fortran-shared PROPERTIES DEPENDS "FORTRAN_testhdf5_fortran;FORTRAN_testhdf5-shared-clear-objects")
-
- #-- Adding test for testhdf5_fortran_1_8
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME FORTRAN_testhdf5_fortran_1_8-shared COMMAND $<TARGET_FILE:testhdf5_fortran_1_8-shared>)
- else ()
- add_test (NAME FORTRAN_testhdf5_fortran_1_8-shared COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:testhdf5_fortran_1_8-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_REGEX= 0 error.s."
- -D "TEST_MATCH= 0 error(s)"
- -D "TEST_OUTPUT=testhdf5_fortran_1_8.txt"
- #-D "TEST_REFERENCE=testhdf5_fortran_1_8.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
-# set_tests_properties (FORTRAN_testhdf5_fortran_1_8-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s")
- set_tests_properties (FORTRAN_testhdf5_fortran_1_8-shared PROPERTIES DEPENDS FORTRAN_testhdf5_fortran_1_8)
-
-
- #-- Adding test for fortranlib_test_F03
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND $<TARGET_FILE:fortranlib_test_F03-shared>)
- else ()
- add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:fortranlib_test_F03-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_REGEX= 0 error.s."
- -D "TEST_MATCH= 0 error(s)"
- -D "TEST_OUTPUT=fortranlib_test_F03.txt"
- #-D "TEST_REFERENCE=fortranlib_test_F03.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
-# set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s")
- set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES DEPENDS FORTRAN_fortranlib_test_F03)
-
- #-- Adding test for vol_connector
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME FORTRAN_vol_connector-shared COMMAND $<TARGET_FILE:vol_connector-shared>)
- else ()
- add_test (NAME FORTRAN_vol_connector-shared COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:vol_connector-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_REGEX= 0 error.s."
- -D "TEST_MATCH= 0 error(s)"
- -D "TEST_OUTPUT=vol_connector.txt"
- #-D "TEST_REFERENCE=vol_connector.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
-# set_tests_properties (FORTRAN_vol_connector-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s")
- set_tests_properties (FORTRAN_vol_connector-shared PROPERTIES DEPENDS FORTRAN_vol_connector)
-
- #-- Adding test for fflush1
- add_test (NAME FORTRAN_fflush1-shared COMMAND $<TARGET_FILE:fflush1-shared>)
- set_tests_properties (FORTRAN_fflush1-shared PROPERTIES DEPENDS FORTRAN_fflush2)
-
- #-- Adding test for fflush2
- add_test (NAME FORTRAN_fflush2-shared COMMAND $<TARGET_FILE:fflush2-shared>)
- set_tests_properties (FORTRAN_fflush2-shared PROPERTIES DEPENDS FORTRAN_fflush1-shared)
+#-- Adding test for fflush1
+add_test (NAME FORTRAN_fflush1 COMMAND $<TARGET_FILE:fflush1>)
+set_tests_properties (FORTRAN_fflush1 PROPERTIES DEPENDS FORTRAN_testhdf5-clear-objects)
-endif ()
+#-- Adding test for fflush2
+add_test (NAME FORTRAN_fflush2 COMMAND $<TARGET_FILE:fflush2>)
+set_tests_properties (FORTRAN_fflush2 PROPERTIES DEPENDS FORTRAN_fflush1)