summaryrefslogtreecommitdiffstats
path: root/c++
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2018-05-14 16:20:03 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2018-05-14 16:20:03 (GMT)
commitea66ac1e67bf2e5ccc59f30e6b648bb39c8f5e42 (patch)
treee71e1c6ffd6b6b4126ed232402beb5a80e5335d9 /c++
parente6bc326ec0c417ef7b003da535b2e071442d2067 (diff)
parentdcc66a4f157ace0858b788228550f3e104df3242 (diff)
downloadhdf5-ea66ac1e67bf2e5ccc59f30e6b648bb39c8f5e42.zip
hdf5-ea66ac1e67bf2e5ccc59f30e6b648bb39c8f5e42.tar.gz
hdf5-ea66ac1e67bf2e5ccc59f30e6b648bb39c8f5e42.tar.bz2
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit 'dcc66a4f157ace0858b788228550f3e104df3242': (35 commits) GGC requires attribute before function Correct COMPILE defs usage Add missing module_dir property Text cleanup Correct sentence punctuation. Add release note. Use set_property for MT flag Correct command usage Remove APPEND Fix typo Add missing test lib add missing folder to path Fix another command revert Missed a command revert Revert to old style for LINK_FLAGS gen expr not working LINK_FLAGS must be separate property sets Fix link flags syntax Revert refactor link flags refactor link flags to interface Refactor link flags ...
Diffstat (limited to 'c++')
-rw-r--r--c++/examples/CMakeLists.txt12
-rw-r--r--c++/src/CMakeLists.txt46
-rw-r--r--c++/test/CMakeLists.txt27
3 files changed, 32 insertions, 53 deletions
diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt
index e05d6f0..5eef265 100644
--- a/c++/examples/CMakeLists.txt
+++ b/c++/examples/CMakeLists.txt
@@ -34,17 +34,17 @@ set (tutr_examples
foreach (example ${examples})
add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp)
- set_property(TARGET cpp_ex_${example} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}")
- TARGET_C_PROPERTIES (cpp_ex_${example} STATIC " " " ")
- target_link_libraries (cpp_ex_${example} ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET})
+ target_include_directories(cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}")
+ TARGET_C_PROPERTIES (cpp_ex_${example} STATIC)
+ target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET})
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)
- set_property(TARGET cpp_ex_${example} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}")
- TARGET_C_PROPERTIES (cpp_ex_${example} STATIC " " " ")
- target_link_libraries (cpp_ex_${example} ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET})
+ target_include_directories(cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}")
+ TARGET_C_PROPERTIES (cpp_ex_${example} STATIC)
+ target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp)
endforeach ()
diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt
index eae86a3..cf7a8a5 100644
--- a/c++/src/CMakeLists.txt
+++ b/c++/src/CMakeLists.txt
@@ -2,19 +2,6 @@ cmake_minimum_required (VERSION 3.10)
project (HDF5_CPP_SRC 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})
-
-#-----------------------------------------------------------------------------
# Generate configure file
#-----------------------------------------------------------------------------
configure_file (${HDF_RESOURCES_DIR}/H5cxx_config.h.in
@@ -96,30 +83,35 @@ set (CPP_HDRS
)
add_library (${HDF5_CPP_LIB_TARGET} STATIC ${CPP_SOURCES} ${CPP_HDRS})
-set_property(TARGET ${HDF5_CPP_LIB_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}")
-TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} STATIC " " " ")
+target_include_directories(${HDF5_CPP_LIB_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+)
+target_compile_definitions(${HDF5_CPP_LIB_TARGET}
+ PRIVATE $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings
+)
+TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} STATIC)
target_link_libraries (${HDF5_CPP_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET})
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIB_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_CPP_LIB_TARGET} ${HDF5_CPP_LIB_NAME} STATIC 0)
-set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES
- FOLDER libraries/cpp
- INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
+set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/cpp)
set (install_targets ${HDF5_CPP_LIB_TARGET})
if (BUILD_SHARED_LIBS)
add_library (${HDF5_CPP_LIBSH_TARGET} SHARED ${CPP_SOURCES} ${CPP_HDRS})
- set_property(TARGET ${HDF5_CPP_LIBSH_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}")
- TARGET_C_PROPERTIES (${HDF5_CPP_LIBSH_TARGET} SHARED " " " ")
+ target_include_directories(${HDF5_CPP_LIBSH_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ target_compile_definitions(${HDF5_CPP_LIBSH_TARGET}
+ PUBLIC "H5_BUILT_AS_DYNAMIC_LIB"
+ PRIVATE $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings
+ )
+ TARGET_C_PROPERTIES (${HDF5_CPP_LIBSH_TARGET} SHARED)
target_link_libraries (${HDF5_CPP_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET})
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIBSH_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_CPP_LIBSH_TARGET} ${HDF5_CPP_LIB_NAME} SHARED "CXX")
- set_target_properties (${HDF5_CPP_LIBSH_TARGET} PROPERTIES
- FOLDER libraries/cpp
- COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB"
- INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
- INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1
- )
+ set_target_properties (${HDF5_CPP_LIBSH_TARGET} PROPERTIES FOLDER libraries/cpp)
set (install_targets ${install_targets} ${HDF5_CPP_LIBSH_TARGET})
endif ()
diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt
index abc7952..33849a9 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}>:MPICH_SKIP_MPICXX;MPICH_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)