summaryrefslogtreecommitdiffstats
path: root/tools/lib/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 /tools/lib/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 'tools/lib/CMakeLists.txt')
-rw-r--r--tools/lib/CMakeLists.txt13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt
index e65673a..8c1cdb6 100644
--- a/tools/lib/CMakeLists.txt
+++ b/tools/lib/CMakeLists.txt
@@ -1,6 +1,7 @@
cmake_minimum_required (VERSION 2.8.11)
PROJECT (HDF5_TOOLS_LIB)
+option (ONLY_STATIC_TOOLS "Build Only Static Tools" OFF)
#-----------------------------------------------------------------------------
# Apply Definitions to compiler in this directory and below
#-----------------------------------------------------------------------------
@@ -36,7 +37,8 @@ set (H5_TOOLS_LIB_HDRS
${HDF5_TOOLS_LIB_SOURCE_DIR}/h5diff.h
)
-add_library (${HDF5_TOOLS_LIB_TARGET} ${LIB_TYPE} ${H5_TOOLS_LIB_SRCS} ${H5_TOOLS_LIB_HDRS})
+add_library (${HDF5_TOOLS_LIB_TARGET}_obj OBJECT ${H5_TOOLS_LIB_SRCS} ${H5_TOOLS_LIB_HDRS})
+add_library (${HDF5_TOOLS_LIB_TARGET} ${LIB_TYPE} $<TARGET_OBJECTS:${HDF5_TOOLS_LIB_TARGET}_obj>)
TARGET_C_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} " " " ")
target_link_libraries (${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIB_TARGET}")
@@ -51,6 +53,15 @@ set_target_properties (${HDF5_TOOLS_LIB_TARGET} PROPERTIES
FOLDER libraries/tools
INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
+if (ONLY_STATIC_TOOLS)
+ add_library (${HDF5_TOOLS_LIB_TARGET}_static STATIC $<TARGET_OBJECTS:${HDF5_TOOLS_LIB_TARGET}_obj>)
+ TARGET_C_PROPERTIES (${HDF5_TOOLS_LIB_TARGET}_static " " " ")
+ target_link_libraries (${HDF5_TOOLS_LIB_TARGET}_static ${HDF5_LIB_TARGET}_static)
+ H5_SET_LIB_OPTIONS (${HDF5_TOOLS_LIB_TARGET}_static ${HDF5_TOOLS_LIB_NAME} STATIC)
+ set_target_properties (${HDF5_TOOLS_LIB_TARGET}_static PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+endif (ONLY_STATIC_TOOLS)
##############################################################################
##############################################################################