summaryrefslogtreecommitdiffstats
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2014-09-03 17:12:52 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2014-09-03 17:12:52 (GMT)
commitc23f3a7ea577b66f103ab06e9310e819c13f5401 (patch)
tree5fd6bbaf00a3973ea0d0e591d9b6256b687c91a2 /src/CMakeLists.txt
parent2154d1c6f1b791a2ba9125a48a098fd4da42f01f (diff)
downloadhdf5-c23f3a7ea577b66f103ab06e9310e819c13f5401.zip
hdf5-c23f3a7ea577b66f103ab06e9310e819c13f5401.tar.gz
hdf5-c23f3a7ea577b66f103ab06e9310e819c13f5401.tar.bz2
[svn-r25569] Added option to build tools static when building shared libraries. This will prevent 'dll' being appended to the tool name on windows. See HDFFV-8292.
Tested: local linux
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d5d57d4..fd02ef7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -858,7 +858,8 @@ set_source_files_properties (${HDF5_BINARY_DIR}/H5version.h GENERATED)
set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5overflow.h)
set_source_files_properties (${HDF5_BINARY_DIR}/H5overflow.h GENERATED)
-add_library (${HDF5_LIB_TARGET} ${LIB_TYPE} ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS})
+add_library (${HDF5_LIB_TARGET}_obj OBJECT ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS})
+add_library (${HDF5_LIB_TARGET} ${LIB_TYPE} $<TARGET_OBJECTS:${HDF5_LIB_TARGET}_obj>)
TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} " " " ")
target_link_libraries (${HDF5_LIB_TARGET} ${LINK_LIBS})
if (NOT WIN32)
@@ -873,6 +874,21 @@ set_target_properties (${HDF5_LIB_TARGET} PROPERTIES
FOLDER libraries
INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
+if (ONLY_STATIC_TOOLS)
+ add_library (${HDF5_LIB_TARGET}_static STATIC $<TARGET_OBJECTS:${HDF5_LIB_TARGET}_obj>)
+ TARGET_C_PROPERTIES (${HDF5_LIB_TARGET}_static " " " ")
+ target_link_libraries (${HDF5_LIB_TARGET}_static ${LINK_LIBS})
+ if (NOT WIN32)
+ target_link_libraries (${HDF5_LIB_TARGET}_static dl)
+ endif (NOT WIN32)
+ if (H5_HAVE_PARALLEL AND MPI_C_FOUND)
+ target_link_libraries (${HDF5_LIB_TARGET}_static ${MPI_C_LIBRARIES})
+ endif (H5_HAVE_PARALLEL AND MPI_C_FOUND)
+ H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET}_static ${HDF5_LIB_NAME} STATIC)
+ set_target_properties (${HDF5_LIB_TARGET}_static PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+endif (ONLY_STATIC_TOOLS)
option (HDF5_ENABLE_DEBUG_APIS "Turn on debugging in all packages" OFF)
if (HDF5_ENABLE_DEBUG_APIS)