diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2014-03-26 15:00:35 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2014-03-26 15:00:35 (GMT) |
commit | d9020f2e35342605b26b6260e05cc4a2cef2327b (patch) | |
tree | 344bb1fde0fd8def1e2228abadc7e64b605e11dc /c++ | |
parent | 3944dcb308de2d380822d2d56cf0d3bd96db5c8f (diff) | |
download | hdf5-d9020f2e35342605b26b6260e05cc4a2cef2327b.zip hdf5-d9020f2e35342605b26b6260e05cc4a2cef2327b.tar.gz hdf5-d9020f2e35342605b26b6260e05cc4a2cef2327b.tar.bz2 |
[svn-r24906] Merge latest CMake changes from trunk.
Tested: local linux
Diffstat (limited to 'c++')
-rw-r--r-- | c++/CMakeLists.txt | 38 | ||||
-rw-r--r-- | c++/examples/CMakeLists.txt | 32 | ||||
-rw-r--r-- | c++/examples/CMakeTests.cmake | 48 | ||||
-rw-r--r-- | c++/src/CMakeLists.txt | 37 | ||||
-rw-r--r-- | c++/test/CMakeLists.txt | 24 | ||||
-rw-r--r-- | c++/test/CMakeTests.cmake | 32 |
6 files changed, 107 insertions, 104 deletions
diff --git a/c++/CMakeLists.txt b/c++/CMakeLists.txt index 50ea838..89426c5 100644 --- a/c++/CMakeLists.txt +++ b/c++/CMakeLists.txt @@ -1,24 +1,24 @@ -cmake_minimum_required (VERSION 2.8.10) +cmake_minimum_required (VERSION 2.8.11) PROJECT (HDF5_CPP) #----------------------------------------------------------------------------- # Apply Definitions to compiler in this directory and below #----------------------------------------------------------------------------- -ADD_DEFINITIONS (${HDF5_EXTRA_C_FLAGS}) +add_definitions (${HDF5_EXTRA_C_FLAGS}) #----------------------------------------------------------------------------- # Shared/Static Libs #----------------------------------------------------------------------------- -IF (BUILD_SHARED_LIBS) - SET (CPP_BUILT_AS_DYNAMIC_LIB 1) -ELSE (BUILD_SHARED_LIBS) - SET (CPP_BUILT_AS_STATIC_LIB 1) -ENDIF (BUILD_SHARED_LIBS) +if (BUILD_SHARED_LIBS) + set (CPP_BUILT_AS_DYNAMIC_LIB 1) +else (BUILD_SHARED_LIBS) + set (CPP_BUILT_AS_STATIC_LIB 1) +endif (BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- # Generate configure file #----------------------------------------------------------------------------- -CONFIGURE_FILE (${HDF5_RESOURCES_DIR}/H5cxx_config.h.in +configure_file (${HDF5_RESOURCES_DIR}/H5cxx_config.h.in ${HDF5_BINARY_DIR}/H5cxx_pubconf.h ) @@ -31,23 +31,23 @@ INCLUDE_DIRECTORIES (${HDF5_BINARY_DIR}) #----------------------------------------------------------------------------- # Parallel/MPI, prevent spurious cpp/cxx warnings #----------------------------------------------------------------------------- -IF (H5_HAVE_PARALLEL) - ADD_DEFINITIONS ("-DMPICH_SKIP_MPICXX") - ADD_DEFINITIONS ("-DMPICH_IGNORE_CXX_SEEK") -ENDIF (H5_HAVE_PARALLEL) +if (H5_HAVE_PARALLEL) + add_definitions ("-DMPICH_SKIP_MPICXX") + add_definitions ("-DMPICH_IGNORE_CXX_SEEK") +endif (H5_HAVE_PARALLEL) -ADD_SUBDIRECTORY (${HDF5_CPP_SOURCE_DIR}/src ${HDF5_CPP_BINARY_DIR}/src) +add_subdirectory (${HDF5_CPP_SOURCE_DIR}/src ${HDF5_CPP_BINARY_DIR}/src) #----------------------------------------------------------------------------- # Build the CPP Examples #----------------------------------------------------------------------------- -IF (HDF5_BUILD_EXAMPLES) - ADD_SUBDIRECTORY (${HDF5_CPP_SOURCE_DIR}/examples ${HDF5_CPP_BINARY_DIR}/examples) -ENDIF (HDF5_BUILD_EXAMPLES) +if (HDF5_BUILD_EXAMPLES) + add_subdirectory (${HDF5_CPP_SOURCE_DIR}/examples ${HDF5_CPP_BINARY_DIR}/examples) +endif (HDF5_BUILD_EXAMPLES) #----------------------------------------------------------------------------- # Build the CPP unit tests #----------------------------------------------------------------------------- -IF (BUILD_TESTING) - ADD_SUBDIRECTORY (${HDF5_CPP_SOURCE_DIR}/test ${HDF5_CPP_BINARY_DIR}/test) -ENDIF (BUILD_TESTING) +if (BUILD_TESTING) + add_subdirectory (${HDF5_CPP_SOURCE_DIR}/test ${HDF5_CPP_BINARY_DIR}/test) +endif (BUILD_TESTING) diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt index c79f6c2..e3e1077 100644 --- a/c++/examples/CMakeLists.txt +++ b/c++/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.10) +cmake_minimum_required (VERSION 2.8.11) # -------------------------------------------------------------------- # Notes: When creating examples they should be prefixed # with "cpp_ex_". This allows for easier filtering of the examples. @@ -10,7 +10,7 @@ PROJECT (HDF5_CPP_EXAMPLES) # Define examples #----------------------------------------------------------------------------- -SET (examples +set (examples create readdata writedata @@ -20,7 +20,7 @@ SET (examples h5group ) -SET (tutr_examples +set (tutr_examples h5tutr_cmprss h5tutr_crtdat h5tutr_crtatt @@ -32,22 +32,22 @@ SET (tutr_examples h5tutr_subset ) -FOREACH (example ${examples}) - ADD_EXECUTABLE (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) +foreach (example ${examples}) + add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) TARGET_NAMING (cpp_ex_${example} ${LIB_TYPE}) TARGET_C_PROPERTIES (cpp_ex_${example} " " " ") - TARGET_LINK_LIBRARIES (cpp_ex_${example} ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) - SET_TARGET_PROPERTIES (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) -ENDFOREACH (example ${examples}) + target_link_libraries (cpp_ex_${example} ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) +endforeach (example ${examples}) -FOREACH (example ${tutr_examples}) - ADD_EXECUTABLE (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) +foreach (example ${tutr_examples}) + add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) TARGET_NAMING (cpp_ex_${example} ${LIB_TYPE}) TARGET_C_PROPERTIES (cpp_ex_${example} " " " ") - TARGET_LINK_LIBRARIES (cpp_ex_${example} ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) - SET_TARGET_PROPERTIES (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) -ENDFOREACH (example ${tutr_examples}) + target_link_libraries (cpp_ex_${example} ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) + set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) +endforeach (example ${tutr_examples}) -IF (BUILD_TESTING) - INCLUDE (CMakeTests.cmake) -ENDIF (BUILD_TESTING) +if (BUILD_TESTING) + include (CMakeTests.cmake) +endif (BUILD_TESTING) diff --git a/c++/examples/CMakeTests.cmake b/c++/examples/CMakeTests.cmake index b39dcfe..352b799 100644 --- a/c++/examples/CMakeTests.cmake +++ b/c++/examples/CMakeTests.cmake @@ -5,7 +5,7 @@ ############################################################################## ############################################################################## # Remove any output file left over from previous test run - ADD_TEST ( + add_test ( NAME cpp_ex-clear-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -15,23 +15,23 @@ SDSextendible.h5 Select.h5 ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (cpp_ex-clear-objects PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "cpp_ex-clear-objects") + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (cpp_ex-clear-objects PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + set (last_test "cpp_ex-clear-objects") - FOREACH (example ${examples}) - ADD_TEST (NAME cpp_ex_${example} COMMAND $<TARGET_FILE:cpp_ex_${example}>) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (cpp_ex_${example} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "cpp_ex_${example}") - ENDFOREACH (example ${examples}) + foreach (example ${examples}) + add_test (NAME cpp_ex_${example} COMMAND $<TARGET_FILE:cpp_ex_${example}>) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (cpp_ex_${example} PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + set (last_test "cpp_ex_${example}") + endforeach (example ${examples}) #the following dependicies are handled by the order of the files # SET_TESTS_PROPERTIES(cpp_ex_readdata PROPERTIES DEPENDS cpp_ex_create) # SET_TESTS_PROPERTIES(cpp_ex_chunks PROPERTIES DEPENDS cpp_ex_extend_ds) - ADD_TEST ( + add_test ( NAME cpp_ex_tutr-clear-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -42,18 +42,18 @@ h5tutr_groups.h5 h5tutr_subset.h5 ) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (cpp_ex_tutr-clear-objects PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "cpp_ex_tutr-clear-objects") + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (cpp_ex_tutr-clear-objects PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + set (last_test "cpp_ex_tutr-clear-objects") - FOREACH (example ${tutr_examples}) - ADD_TEST (NAME cpp_ex_${example} COMMAND $<TARGET_FILE:cpp_ex_${example}>) - IF (NOT "${last_test}" STREQUAL "") - SET_TESTS_PROPERTIES (cpp_ex_${example} PROPERTIES DEPENDS ${last_test}) - ENDIF (NOT "${last_test}" STREQUAL "") - SET (last_test "cpp_ex_${example}") - ENDFOREACH (example ${tutr_examples}) + foreach (example ${tutr_examples}) + add_test (NAME cpp_ex_${example} COMMAND $<TARGET_FILE:cpp_ex_${example}>) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (cpp_ex_${example} PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + set (last_test "cpp_ex_${example}") + endforeach (example ${tutr_examples}) #the following dependicies are handled by the order of the files # SET_TESTS_PROPERTIES(cpp_ex_h5tutr_crtatt PROPERTIES DEPENDS cpp_ex_h5tutr_crtdat) # SET_TESTS_PROPERTIES(cpp_ex_h5tutr_rdwt PROPERTIES DEPENDS cpp_ex_h5tutr_crtdat) diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index af6283a..7a48260 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -1,24 +1,24 @@ -cmake_minimum_required (VERSION 2.8.10) +cmake_minimum_required (VERSION 2.8.11) PROJECT (HDF5_CPP_SRC) #----------------------------------------------------------------------------- # Shared/Static Libs #----------------------------------------------------------------------------- -IF (BUILD_SHARED_LIBS) - SET (CPP_BUILT_AS_DYNAMIC_LIB 1) -ENDIF (BUILD_SHARED_LIBS) +if (BUILD_SHARED_LIBS) + set (CPP_BUILT_AS_DYNAMIC_LIB 1) +endif (BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- # Generate configure file #----------------------------------------------------------------------------- -CONFIGURE_FILE (${HDF5_RESOURCES_DIR}/H5cxx_config.h.in +configure_file (${HDF5_RESOURCES_DIR}/H5cxx_config.h.in ${HDF5_BINARY_DIR}/H5cxx_pubconf.h ) #----------------------------------------------------------------------------- # Define cpp Library #----------------------------------------------------------------------------- -SET (CPP_SRCS +set (CPP_SRCS ${HDF5_CPP_SRC_SOURCE_DIR}/H5AbstractDs.cpp ${HDF5_CPP_SRC_SOURCE_DIR}/H5ArrayType.cpp ${HDF5_CPP_SRC_SOURCE_DIR}/H5AtomType.cpp @@ -48,7 +48,7 @@ SET (CPP_SRCS ${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.cpp ) -SET (CPP_HDRS +set (CPP_HDRS ${HDF5_CPP_SRC_SOURCE_DIR}/H5AbstractDs.h ${HDF5_CPP_SRC_SOURCE_DIR}/H5Alltypes.h ${HDF5_CPP_SRC_SOURCE_DIR}/H5ArrayType.h @@ -83,17 +83,20 @@ SET (CPP_HDRS ${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.h ) -ADD_LIBRARY (${HDF5_CPP_LIB_TARGET} ${LIB_TYPE} ${CPP_SRCS} ${CPP_HDRS}) +add_library (${HDF5_CPP_LIB_TARGET} ${LIB_TYPE} ${CPP_SRCS} ${CPP_HDRS}) TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} " " " ") -TARGET_LINK_LIBRARIES (${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) -SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIB_TARGET}") +target_link_libraries (${HDF5_CPP_LIB_TARGET} ${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} ${LIB_TYPE}) -SET_TARGET_PROPERTIES (${HDF5_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/cpp) +set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES + FOLDER libraries/cpp + INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" +) #----------------------------------------------------------------------------- # Add file(s) to CMake Install #----------------------------------------------------------------------------- -INSTALL ( +install ( FILES ${CPP_HDRS} DESTINATION @@ -105,12 +108,12 @@ INSTALL ( #----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects #----------------------------------------------------------------------------- -IF (HDF5_EXPORTED_TARGETS) - IF (BUILD_SHARED_LIBS) +if (HDF5_EXPORTED_TARGETS) + if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} cpplibraries) - ENDIF (BUILD_SHARED_LIBS) + endif (BUILD_SHARED_LIBS) - INSTALL ( + install ( TARGETS ${HDF5_CPP_LIB_TARGET} EXPORT @@ -119,4 +122,4 @@ IF (HDF5_EXPORTED_TARGETS) ARCHIVE DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT cpplibraries RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT cpplibraries ) -ENDIF (HDF5_EXPORTED_TARGETS) +endif (HDF5_EXPORTED_TARGETS) diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index e498fc5..9966163 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.10) +cmake_minimum_required (VERSION 2.8.11) PROJECT (HDF5_CPP_TEST) # -------------------------------------------------------------------- # Notes: When creating unit test executables they should be prefixed @@ -11,7 +11,7 @@ PROJECT (HDF5_CPP_TEST) #----------------------------------------------------------------------------- # Define Sources #----------------------------------------------------------------------------- -SET (CPP_TEST_SRCS +set (CPP_TEST_SRCS ${HDF5_CPP_TEST_SOURCE_DIR}/testhdf5.cpp ${HDF5_CPP_TEST_SOURCE_DIR}/tattr.cpp ${HDF5_CPP_TEST_SOURCE_DIR}/tcompound.cpp @@ -29,27 +29,27 @@ SET (CPP_TEST_SRCS #----------------------------------------------------------------------------- # Generate the H5srcdir_str.h file containing user settings needed by compilation #----------------------------------------------------------------------------- -SET (srcdir ${CMAKE_CURRENT_SOURCE_DIR}) -CONFIGURE_FILE (${HDF5_CPP_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY) -INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR}) +set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}) +configure_file (${HDF5_CPP_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY) -INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR} ) - -ADD_EXECUTABLE (cpp_testhdf5 ${CPP_TEST_SRCS} ) +add_executable (cpp_testhdf5 ${CPP_TEST_SRCS} ) TARGET_NAMING (cpp_testhdf5 ${LIB_TYPE}) TARGET_C_PROPERTIES (cpp_testhdf5 " " " ") -TARGET_LINK_LIBRARIES (cpp_testhdf5 +target_link_libraries (cpp_testhdf5 ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ) -SET_TARGET_PROPERTIES (cpp_testhdf5 PROPERTIES FOLDER test/cpp) +set_target_properties (cpp_testhdf5 PROPERTIES + FOLDER test/cpp + INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" +) -ADD_CUSTOM_COMMAND ( +add_custom_command ( TARGET cpp_testhdf5 POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_CPP_TEST_SOURCE_DIR}/th5s.h5 ${PROJECT_BINARY_DIR}/th5s.h5 ) -INCLUDE (CMakeTests.cmake) +include (CMakeTests.cmake) diff --git a/c++/test/CMakeTests.cmake b/c++/test/CMakeTests.cmake index 3e4f6d9..2b05fea 100644 --- a/c++/test/CMakeTests.cmake +++ b/c++/test/CMakeTests.cmake @@ -5,7 +5,7 @@ ############################################################################## ############################################################################## # Remove any output file left over from previous test run -ADD_TEST ( +add_test ( NAME cpp_testhdf5-clear-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -17,12 +17,12 @@ ADD_TEST ( tfattrs.h5 ) -ADD_TEST (NAME cpp_testhdf5 COMMAND $<TARGET_FILE:cpp_testhdf5>) -SET_TESTS_PROPERTIES (cpp_testhdf5 PROPERTIES DEPENDS cpp_testhdf5-clear-objects) +add_test (NAME cpp_testhdf5 COMMAND $<TARGET_FILE:cpp_testhdf5>) +set_tests_properties (cpp_testhdf5 PROPERTIES DEPENDS cpp_testhdf5-clear-objects) -IF (HDF5_TEST_VFD) +if (HDF5_TEST_VFD) - SET (VFD_LIST + set (VFD_LIST sec2 stdio core @@ -31,13 +31,13 @@ IF (HDF5_TEST_VFD) family ) - IF (DIRECT_VFD) - SET (VFD_LIST ${VFD_LIST} direct) - ENDIF (DIRECT_VFD) + if (DIRECT_VFD) + set (VFD_LIST ${VFD_LIST} direct) + endif (DIRECT_VFD) MACRO (ADD_VFD_TEST vfdname resultcode) - IF (NOT HDF5_ENABLE_USING_MEMCHECKER) - ADD_TEST ( + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( NAME VFD-${vfdname}-cpp_testhdf5-clear-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -48,7 +48,7 @@ IF (HDF5_TEST_VFD) tattr_scalar.h5 tfattrs.h5 ) - ADD_TEST ( + add_test ( NAME VFD-${vfdname}-cpp_testhdf5 COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:cpp_testhdf5>" @@ -59,13 +59,13 @@ IF (HDF5_TEST_VFD) -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -P "${HDF5_RESOURCES_DIR}/vfdTest.cmake" ) - SET_TESTS_PROPERTIES (VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS VFD-${vfdname}-cpp_testhdf5-clear-objects) - ENDIF (NOT HDF5_ENABLE_USING_MEMCHECKER) + set_tests_properties (VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS VFD-${vfdname}-cpp_testhdf5-clear-objects) + endif (NOT HDF5_ENABLE_USING_MEMCHECKER) ENDMACRO (ADD_VFD_TEST) # Run test with different Virtual File Driver - FOREACH (vfd ${VFD_LIST}) + foreach (vfd ${VFD_LIST}) ADD_VFD_TEST (${vfd} 0) - ENDFOREACH (vfd ${VFD_LIST}) + endforeach (vfd ${VFD_LIST}) -ENDIF (HDF5_TEST_VFD) +endif (HDF5_TEST_VFD) |