diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2018-09-19 13:52:13 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2018-09-19 13:52:13 (GMT) |
commit | d2806d4875074efd03431385922480e27e32a060 (patch) | |
tree | 171b142917a267e2fca0de0754e5a2de961a07a3 | |
parent | 521eebbce20a6d4149176b78c8886fdb2c8850e2 (diff) | |
download | hdf5-d2806d4875074efd03431385922480e27e32a060.zip hdf5-d2806d4875074efd03431385922480e27e32a060.tar.gz hdf5-d2806d4875074efd03431385922480e27e32a060.tar.bz2 |
HDFFV-10332 Adjust checks and generation of files
-rw-r--r-- | src/CMakeLists.txt | 73 |
1 files changed, 52 insertions, 21 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1cd0a10..e90e580 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -860,6 +860,10 @@ else () set (HDF5_GENERATED_SOURCE_DIR ${HDF5_BINARY_DIR}) endif () +if (BUILD_SHARED_LIBS) + file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared") +endif () + if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) target_include_directories(H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") @@ -877,6 +881,30 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c) DEPENDS H5detect WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) + if (BUILD_SHARED_LIBS) + if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + COMMAND $<TARGET_FILE:H5detect> + ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + DEPENDS H5detect + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}/shared + ) + else () + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) + endif () + endif () +else () + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE) + if (BUILD_SHARED_LIBS) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c" + DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c + ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE) + endif () endif () if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c) @@ -896,6 +924,30 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c) DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} ) + if (BUILD_SHARED_LIBS) + if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c + COMMAND $<TARGET_FILE:H5make_libsettings> + ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c + DEPENDS H5make_libsettings + WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} + ) + else () + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) + endif () + endif () +else () + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c PROPERTIES GENERATED TRUE) + if (BUILD_SHARED_LIBS) + add_custom_command ( + OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c" + DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5lib_settings.c + ) + set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE) + endif () endif () ## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" @@ -933,27 +985,6 @@ set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries) set (install_targets ${HDF5_LIB_TARGET}) if (BUILD_SHARED_LIBS) - file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared") - if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c) - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - COMMAND $<TARGET_FILE:H5detect> - ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c - DEPENDS H5detect - WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}/shared - ) - endif () - - if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c) - add_custom_command ( - OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c - COMMAND $<TARGET_FILE:H5make_libsettings> - ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c - DEPENDS H5make_libsettings - WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR} - ) - endif () - set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_GENERATED_SOURCE_DIR}/shared/H5lib_settings.c) add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) |