summaryrefslogtreecommitdiffstats
path: root/fortran/src
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-02-25 22:04:56 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-02-25 22:04:56 (GMT)
commit2af8a87af0d7a1589a4df22d16b2d2513876e7a9 (patch)
treeea10c37bdb3ae9138bd372df262a77ded87f3c4f /fortran/src
parent4906d3d6a82e1dcc10bae150a1e0dc9bbc890259 (diff)
downloadhdf5-2af8a87af0d7a1589a4df22d16b2d2513876e7a9.zip
hdf5-2af8a87af0d7a1589a4df22d16b2d2513876e7a9.tar.gz
hdf5-2af8a87af0d7a1589a4df22d16b2d2513876e7a9.tar.bz2
Copy generated files instead creating twice
Diffstat (limited to 'fortran/src')
-rw-r--r--fortran/src/CMakeLists.txt40
1 files changed, 32 insertions, 8 deletions
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt
index f333f60..b5d1a60 100644
--- a/fortran/src/CMakeLists.txt
+++ b/fortran/src/CMakeLists.txt
@@ -80,13 +80,25 @@ add_executable (H5match_types
${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}/H5f90i_gen.h
+ ${HDF5_F90_BINARY_DIR}/H5fortran_types.F90
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5match_types>
+ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}
+ DEPENDS H5match_types
+)
+
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 ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5match_types>
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5f90i_gen.h" "${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h"
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5fortran_types.F90" "${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90"
WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static
- DEPENDS H5match_types
+ DEPENDS ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h
)
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)
@@ -95,9 +107,12 @@ if (BUILD_SHARED_LIBS)
add_custom_command (
OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h
${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5match_types>
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5f90i_gen.h" "${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h"
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5fortran_types.F90" "${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90"
WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared
- DEPENDS H5match_types
+ DEPENDS ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h
)
set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/H5f90i_gen.h PROPERTIES GENERATED TRUE)
set_source_files_properties (${HDF5_F90_BINARY_DIR}/shared/H5fortran_types.F90 PROPERTIES GENERATED TRUE)
@@ -180,12 +195,20 @@ 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}/H5_gen.F90
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5_buildiface>
+ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}
+ DEPENDS ${f90_F_GEN_SOURCES}
+ COMMENT "Generating the H5_gen.F90 file"
+)
if (NOT ONLY_SHARED_LIBS)
add_custom_command (
OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5_gen.F90
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5_buildiface>
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5_gen.F90" "${HDF5_F90_BINARY_DIR}/static/H5_gen.F90"
WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/static
- DEPENDS ${f90_F_GEN_SOURCES}
+ DEPENDS ${HDF5_F90_BINARY_DIR}/H5_gen.F90
COMMENT "Generating the H5_gen.F90 file"
)
add_custom_target (H5gen ALL
@@ -197,9 +220,10 @@ endif ()
if (BUILD_SHARED_LIBS)
add_custom_command (
OUTPUT ${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:H5_buildiface>
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different "${HDF5_F90_BINARY_DIR}/H5_gen.F90" "${HDF5_F90_BINARY_DIR}/shared/H5_gen.F90"
WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}/shared
- DEPENDS ${f90_F_GEN_SOURCES}
+ DEPENDS ${HDF5_F90_BINARY_DIR}/H5_gen.F90
COMMENT "Generating the H5_gen.F90 shared file"
)
add_custom_target (H5genSH ALL