summaryrefslogtreecommitdiffstats
path: root/hl/c++
diff options
context:
space:
mode:
Diffstat (limited to 'hl/c++')
-rw-r--r--hl/c++/Makefile.am8
-rw-r--r--hl/c++/examples/CMakeLists.txt23
-rw-r--r--hl/c++/src/CMakeLists.txt34
-rw-r--r--hl/c++/test/CMakeLists.txt29
4 files changed, 63 insertions, 31 deletions
diff --git a/hl/c++/Makefile.am b/hl/c++/Makefile.am
index 1968bf5..f9ea328 100644
--- a/hl/c++/Makefile.am
+++ b/hl/c++/Makefile.am
@@ -18,7 +18,13 @@
include $(top_srcdir)/config/commence.am
-SUBDIRS=src test
+if BUILD_TESTS_CONDITIONAL
+ TESTSERIAL_DIR =test
+else
+ TESTSERIAL_DIR=
+endif
+
+SUBDIRS=src $(TESTSERIAL_DIR)
DIST_SUBDIRS=src test examples
# Install examples
diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt
index 8e64239..50e08e8 100644
--- a/hl/c++/examples/CMakeLists.txt
+++ b/hl/c++/examples/CMakeLists.txt
@@ -5,13 +5,22 @@ project (HDF5_HL_CPP_EXAMPLES CXX)
# Add in the examples for the Packet Table codes
# --------------------------------------------------------------------
add_executable (ptExampleFL ${HDF5_HL_CPP_EXAMPLES_SOURCE_DIR}/ptExampleFL.cpp)
-target_include_directories(ptExampleFL PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (ptExampleFL STATIC)
-target_link_libraries (ptExampleFL PRIVATE
- ${HDF5_HL_CPP_LIB_TARGET}
- ${HDF5_HL_LIB_TARGET}
- ${HDF5_LIB_TARGET}
-)
+target_include_directories (ptExampleFL PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (ptExampleFL STATIC)
+ target_link_libraries (ptExampleFL PRIVATE
+ ${HDF5_HL_CPP_LIB_TARGET}
+ ${HDF5_HL_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+ )
+else ()
+ TARGET_C_PROPERTIES (ptExampleFL SHARED)
+ target_link_libraries (ptExampleFL PRIVATE
+ ${HDF5_HL_CPP_LIBSH_TARGET}
+ ${HDF5_HL_LIBSH_TARGET}
+ ${HDF5_LIBSH_TARGET}
+ )
+endif ()
set_target_properties (ptExampleFL PROPERTIES FOLDER examples/hl/cpp)
if (BUILD_TESTING)
diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt
index 77419c6..eb83d8c 100644
--- a/hl/c++/src/CMakeLists.txt
+++ b/hl/c++/src/CMakeLists.txt
@@ -8,21 +8,23 @@ project (HDF5_HL_CPP_SRC CXX)
set (HDF5_HL_CPP_SOURCES ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.cpp)
set (HDF5_HL_CPP_HDRS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.h)
-add_library (${HDF5_HL_CPP_LIB_TARGET} STATIC ${HDF5_HL_CPP_SOURCES})
-target_include_directories(${HDF5_HL_CPP_LIB_TARGET}
- PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
- INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
-TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} STATIC)
-target_link_libraries (${HDF5_HL_CPP_LIB_TARGET} PUBLIC ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
-set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIB_TARGET}")
-H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_HL_CPP_LIB_NAME} STATIC 0)
-set_target_properties (${HDF5_HL_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/hl)
-set (install_targets ${HDF5_HL_CPP_LIB_TARGET})
+if (NOT ONLY_SHARED_LIBS)
+ add_library (${HDF5_HL_CPP_LIB_TARGET} STATIC ${HDF5_HL_CPP_SOURCES})
+ target_include_directories (${HDF5_HL_CPP_LIB_TARGET}
+ PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} STATIC)
+ target_link_libraries (${HDF5_HL_CPP_LIB_TARGET} PUBLIC ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET})
+ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIB_TARGET}")
+ H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_HL_CPP_LIB_NAME} STATIC 0)
+ set_target_properties (${HDF5_HL_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/hl)
+ set (install_targets ${HDF5_HL_CPP_LIB_TARGET})
+endif ()
if (BUILD_SHARED_LIBS)
add_library (${HDF5_HL_CPP_LIBSH_TARGET} SHARED ${HDF5_HL_CPP_SOURCES})
- target_include_directories(${HDF5_HL_CPP_LIBSH_TARGET}
+ target_include_directories (${HDF5_HL_CPP_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
@@ -56,7 +58,9 @@ if (HDF5_EXPORTED_TARGETS)
if (BUILD_SHARED_LIBS)
INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries)
endif ()
- INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries)
+ if (NOT ONLY_SHARED_LIBS)
+ INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries)
+ endif ()
install (
TARGETS
@@ -83,7 +87,9 @@ set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}")
set (_PKG_CONFIG_LIBS_PRIVATE)
-set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_CPP_LIB_CORENAME}")
+if (NOT ONLY_SHARED_LIBS)
+ set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_HL_CPP_LIB_CORENAME}")
+endif ()
if (BUILD_SHARED_LIBS)
set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_HL_CPP_LIB_CORENAME}")
endif ()
diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt
index 68c049c..cfb24a8 100644
--- a/hl/c++/test/CMakeLists.txt
+++ b/hl/c++/test/CMakeLists.txt
@@ -2,15 +2,26 @@ cmake_minimum_required (VERSION 3.10)
project (HDF5_HL_CPP_TEST CXX)
add_executable (hl_ptableTest ${HDF5_HL_CPP_TEST_SOURCE_DIR}/ptableTest.cpp)
-target_include_directories(hl_ptableTest PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (hl_ptableTest STATIC)
-target_link_libraries (hl_ptableTest PRIVATE
- ${HDF5_LIB_TARGET}
- ${HDF5_TEST_LIB_TARGET}
- ${HDF5_CPP_LIB_TARGET}
- ${HDF5_HL_LIB_TARGET}
- ${HDF5_HL_CPP_LIB_TARGET}
-)
+target_include_directories (hl_ptableTest PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+if (NOT BUILD_SHARED_LIBS)
+ TARGET_C_PROPERTIES (hl_ptableTest STATIC)
+ target_link_libraries (hl_ptableTest PRIVATE
+ ${HDF5_LIB_TARGET}
+ ${HDF5_TEST_LIB_TARGET}
+ ${HDF5_CPP_LIB_TARGET}
+ ${HDF5_HL_LIB_TARGET}
+ ${HDF5_HL_CPP_LIB_TARGET}
+ )
+else ()
+ TARGET_C_PROPERTIES (hl_ptableTest SHARED)
+ target_link_libraries (hl_ptableTest PRIVATE
+ ${HDF5_LIBSH_TARGET}
+ ${HDF5_TEST_LIBSH_TARGET}
+ ${HDF5_CPP_LIBSH_TARGET}
+ ${HDF5_HL_LIBSH_TARGET}
+ ${HDF5_HL_CPP_LIBSH_TARGET}
+ )
+endif ()
set_target_properties (hl_ptableTest PROPERTIES FOLDER test/hl/cpp)
include (CMakeTests.cmake)