summaryrefslogtreecommitdiffstats
path: root/c++/test
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2018-04-26 21:41:04 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2018-04-26 21:41:04 (GMT)
commit2347bffaa2d48b62a22575fbc93b1f5c2716d8d4 (patch)
tree963395e7cd4bd66761194c8cee840906b16abb3a /c++/test
parentbc9a773b994cde788e97e5e998eb5fcd21ec8a39 (diff)
downloadhdf5-2347bffaa2d48b62a22575fbc93b1f5c2716d8d4.zip
hdf5-2347bffaa2d48b62a22575fbc93b1f5c2716d8d4.tar.gz
hdf5-2347bffaa2d48b62a22575fbc93b1f5c2716d8d4.tar.bz2
TRILABS-19 remove add_defintions and use generator expressions
Diffstat (limited to 'c++/test')
-rw-r--r--c++/test/CMakeLists.txt27
1 files changed, 7 insertions, 20 deletions
diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt
index abc7952..0815aa8 100644
--- a/c++/test/CMakeLists.txt
+++ b/c++/test/CMakeLists.txt
@@ -1,19 +1,6 @@
cmake_minimum_required (VERSION 3.10)
project (HDF5_CPP_TEST CXX)
-#-----------------------------------------------------------------------------
-# Parallel/MPI, prevent spurious cpp/cxx warnings
-#-----------------------------------------------------------------------------
-if (H5_HAVE_PARALLEL)
- add_definitions ("-DMPICH_SKIP_MPICXX")
- add_definitions ("-DMPICH_IGNORE_CXX_SEEK")
-endif ()
-
-#-----------------------------------------------------------------------------
-# Apply Definitions to compiler in this directory and below
-#-----------------------------------------------------------------------------
-add_definitions (${HDF_EXTRA_C_FLAGS})
-
# --------------------------------------------------------------------
# Notes: When creating unit test executables they should be prefixed
# with "cpp_". This allows for easier filtering of the test suite when
@@ -51,16 +38,16 @@ set (srcdir ${CMAKE_CURRENT_SOURCE_DIR})
configure_file (${HDF5_CPP_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY)
add_executable (cpp_testhdf5 ${CPP_TEST_SOURCES} )
-set_property(TARGET cpp_testhdf5 APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR}")
-TARGET_C_PROPERTIES (cpp_testhdf5 STATIC " " " ")
-target_link_libraries (cpp_testhdf5
+target_include_directories(cpp_testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR}")
+target_compile_definitions(cpp_testhdf5
+ PRIVATE $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:"-DMPICH_SKIP_MPICXX;-DMPICH_IGNORE_CXX_SEEK"># Parallel/MPI, prevent spurious cpp/cxx warnings
+)
+TARGET_C_PROPERTIES (cpp_testhdf5 STATIC)
+target_link_libraries (cpp_testhdf5 PRIVATE
${HDF5_CPP_LIB_TARGET}
${HDF5_LIB_TARGET}
${HDF5_TEST_LIB_TARGET}
)
-set_target_properties (cpp_testhdf5 PROPERTIES
- FOLDER test/cpp
- INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
+set_target_properties (cpp_testhdf5 PROPERTIES FOLDER test/cpp)
include (CMakeTests.cmake)