diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2019-06-18 12:46:25 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2019-06-18 12:46:25 (GMT) |
commit | e7f16c6f2c7b031d7e9b4ba22a9fcdad4d258360 (patch) | |
tree | 18f277bcdb333d7091c598c39b70e4a2e3b50cd0 /c++/examples | |
parent | f73a190d2c2e2bfe80508599e0d76d62c358ae68 (diff) | |
download | hdf5-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 'c++/examples')
-rw-r--r-- | c++/examples/CMakeLists.txt | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt index d3a18f2..2088019 100644 --- a/c++/examples/CMakeLists.txt +++ b/c++/examples/CMakeLists.txt @@ -34,17 +34,27 @@ set (tutr_examples foreach (example ${examples}) add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) - target_include_directories(cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (cpp_ex_${example} STATIC) - target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_include_directories (cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (cpp_ex_${example} STATIC) + target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (cpp_ex_${example} SHARED) + target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) endforeach () foreach (example ${tutr_examples}) add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) - target_include_directories(cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (cpp_ex_${example} STATIC) - target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_include_directories (cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (cpp_ex_${example} STATIC) + target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (cpp_ex_${example} SHARED) + target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + endif () set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) endforeach () |