summaryrefslogtreecommitdiffstats
path: root/hl/test/CMakeLists.txt
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2019-06-18 12:46:25 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2019-06-18 12:46:25 (GMT)
commite7f16c6f2c7b031d7e9b4ba22a9fcdad4d258360 (patch)
tree18f277bcdb333d7091c598c39b70e4a2e3b50cd0 /hl/test/CMakeLists.txt
parentf73a190d2c2e2bfe80508599e0d76d62c358ae68 (diff)
downloadhdf5-e7f16c6f2c7b031d7e9b4ba22a9fcdad4d258360.zip
hdf5-e7f16c6f2c7b031d7e9b4ba22a9fcdad4d258360.tar.gz
hdf5-e7f16c6f2c7b031d7e9b4ba22a9fcdad4d258360.tar.bz2
HDFFV-10805 Add option to only build shared targets
HDFFV-10805 Add ONLY_SHARED_LIBS option and prefer shared over static HDFFV-10803 Update FindSZIP.cmake find module Remove unneeded modules and update java modules
Diffstat (limited to 'hl/test/CMakeLists.txt')
-rw-r--r--hl/test/CMakeLists.txt68
1 files changed, 37 insertions, 31 deletions
diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt
index 238b5e1..2959c6c 100644
--- a/hl/test/CMakeLists.txt
+++ b/hl/test/CMakeLists.txt
@@ -17,29 +17,26 @@ configure_file (${HDF5_HL_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ON
# --------------------------------------------------------------------
# Macro used to add a unit test
# --------------------------------------------------------------------
-MACRO (HL_ADD_EXE hl_name)
+macro (HL_ADD_EXE hl_name)
add_executable (hl_${hl_name} ${hl_name}.c)
- target_include_directories(hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (hl_${hl_name} STATIC)
- target_link_libraries (hl_${hl_name} PRIVATE
- ${HDF5_HL_LIB_TARGET}
- ${HDF5_TEST_LIB_TARGET}
- ${HDF5_LIB_TARGET}
- )
- set_target_properties (hl_${hl_name} PROPERTIES FOLDER test/hl)
-ENDMACRO ()
-
-MACRO (HL_ADD_SHEXE hl_name)
- add_executable (hl_${hl_name} ${hl_name}.c)
- target_include_directories(hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (hl_${hl_name} SHARED)
- target_link_libraries (hl_${hl_name} PRIVATE
- ${HDF5_HL_LIBSH_TARGET}
- ${HDF5_TEST_LIBSH_TARGET}
- ${HDF5_LIBSH_TARGET}
- )
+ target_include_directories (hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (hl_${hl_name} STATIC)
+ target_link_libraries (hl_${hl_name} PRIVATE
+ ${HDF5_HL_LIB_TARGET}
+ ${HDF5_TEST_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+ )
+ else ()
+ TARGET_C_PROPERTIES (hl_${hl_name} SHARED)
+ target_link_libraries (hl_${hl_name} PRIVATE
+ ${HDF5_HL_LIBSH_TARGET}
+ ${HDF5_TEST_LIBSH_TARGET}
+ ${HDF5_LIBSH_TARGET}
+ )
+ endif ()
set_target_properties (hl_${hl_name} PROPERTIES FOLDER test/hl)
-ENDMACRO ()
+endmacro ()
HL_ADD_EXE (test_lite)
HL_ADD_EXE (test_image)
@@ -52,22 +49,31 @@ HL_ADD_EXE (test_h5do_compat)
# test_packet has two source files
add_executable (hl_test_packet test_packet.c test_packet_vlen.c)
-target_include_directories(hl_test_packet PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (hl_test_packet STATIC)
-target_link_libraries (hl_test_packet PRIVATE
- ${HDF5_HL_LIB_TARGET}
- ${HDF5_TEST_LIB_TARGET}
- ${HDF5_LIB_TARGET}
-)
+target_include_directories (hl_test_packet PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (hl_test_packet STATIC)
+ target_link_libraries (hl_test_packet PRIVATE
+ ${HDF5_HL_LIB_TARGET}
+ ${HDF5_TEST_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+ )
+else ()
+ TARGET_C_PROPERTIES (hl_test_packet SHARED)
+ target_link_libraries (hl_test_packet PRIVATE
+ ${HDF5_HL_LIBSH_TARGET}
+ ${HDF5_TEST_LIBSH_TARGET}
+ ${HDF5_LIBSH_TARGET}
+ )
+endif ()
set_target_properties (hl_test_packet PROPERTIES FOLDER test/hl)
# --------------------------------------------------------------------
# This executable is used to generate test files for the test_ds test.
# It should only be run during development when new test files are needed
# --------------------------------------------------------------------
-if (HDF5_BUILD_GENERATORS)
+if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS)
add_executable (hl_gen_test_ds gen_test_ds.c)
- target_include_directories(hl_gen_test_ds PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (hl_gen_test_ds PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (hl_gen_test_ds STATIC)
target_link_libraries (hl_gen_test_ds PRIVATE
${HDF5_HL_LIB_TARGET}
@@ -77,7 +83,7 @@ if (HDF5_BUILD_GENERATORS)
set_target_properties (hl_gen_test_ds PROPERTIES FOLDER test/hl/gen)
add_executable (hl_gen_test_ld gen_test_ld.c)
- target_include_directories(hl_gen_test_ld PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (hl_gen_test_ld PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (hl_gen_test_ld STATIC)
target_link_libraries (hl_gen_test_ld PRIVATE
${HDF5_HL_LIB_TARGET}