summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt56
1 files changed, 35 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 52a883e..2a552a0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -138,18 +138,30 @@ set (HDF5_HL_F90_C_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_HL_F90_C_LIB_
#-----------------------------------------------------------------------------
# Set the target names of all the libraries
#-----------------------------------------------------------------------------
-set (HDF5_LIB_TARGET ${HDF5_LIB_CORENAME})
-set (HDF5_TEST_LIB_TARGET ${HDF5_TEST_LIB_CORENAME})
-set (HDF5_CPP_LIB_TARGET ${HDF5_CPP_LIB_CORENAME})
-set (HDF5_HL_LIB_TARGET ${HDF5_HL_LIB_CORENAME})
-set (HDF5_HL_CPP_LIB_TARGET ${HDF5_HL_CPP_LIB_CORENAME})
-set (HDF5_TOOLS_LIB_TARGET ${HDF5_TOOLS_LIB_CORENAME})
-set (HDF5_F90_LIB_TARGET ${HDF5_F90_LIB_CORENAME})
-set (HDF5_F90_C_LIB_TARGET ${HDF5_F90_C_LIB_CORENAME})
-set (HDF5_F90_TEST_LIB_TARGET ${HDF5_F90_TEST_LIB_CORENAME})
-set (HDF5_F90_C_TEST_LIB_TARGET ${HDF5_F90_C_TEST_LIB_CORENAME})
-set (HDF5_HL_F90_LIB_TARGET ${HDF5_HL_F90_LIB_CORENAME})
-set (HDF5_HL_F90_C_LIB_TARGET ${HDF5_HL_F90_C_LIB_CORENAME})
+set (HDF5_LIB_TARGET "${HDF5_LIB_CORENAME}-static")
+set (HDF5_TEST_LIB_TARGET "${HDF5_TEST_LIB_CORENAME}-static")
+set (HDF5_CPP_LIB_TARGET "${HDF5_CPP_LIB_CORENAME}-static")
+set (HDF5_HL_LIB_TARGET "${HDF5_HL_LIB_CORENAME}-static")
+set (HDF5_HL_CPP_LIB_TARGET "${HDF5_HL_CPP_LIB_CORENAME}-static")
+set (HDF5_TOOLS_LIB_TARGET "${HDF5_TOOLS_LIB_CORENAME}-static")
+set (HDF5_F90_LIB_TARGET "${HDF5_F90_LIB_CORENAME}-static")
+set (HDF5_F90_C_LIB_TARGET "${HDF5_F90_C_LIB_CORENAME}-static")
+set (HDF5_F90_TEST_LIB_TARGET "${HDF5_F90_TEST_LIB_CORENAME}-static")
+set (HDF5_F90_C_TEST_LIB_TARGET "${HDF5_F90_C_TEST_LIB_CORENAME}-static")
+set (HDF5_HL_F90_LIB_TARGET "${HDF5_HL_F90_LIB_CORENAME}-static")
+set (HDF5_HL_F90_C_LIB_TARGET "${HDF5_HL_F90_C_LIB_CORENAME}-static")
+set (HDF5_LIBSH_TARGET "${HDF5_LIB_CORENAME}-shared")
+set (HDF5_TEST_LIBSH_TARGET "${HDF5_TEST_LIB_CORENAME}-shared")
+set (HDF5_CPP_LIBSH_TARGET "${HDF5_CPP_LIB_CORENAME}-shared")
+set (HDF5_HL_LIBSH_TARGET "${HDF5_HL_LIB_CORENAME}-shared")
+set (HDF5_HL_CPP_LIBSH_TARGET "${HDF5_HL_CPP_LIB_CORENAME}-shared")
+set (HDF5_TOOLS_LIBSH_TARGET "${HDF5_TOOLS_LIB_CORENAME}-shared")
+set (HDF5_F90_LIBSH_TARGET "${HDF5_F90_LIB_CORENAME}-shared")
+set (HDF5_F90_C_LIBSH_TARGET "${HDF5_F90_C_LIB_CORENAME}-shared")
+set (HDF5_F90_TEST_LIBSH_TARGET "${HDF5_F90_TEST_LIB_CORENAME}-shared")
+set (HDF5_F90_C_TEST_LIBSH_TARGET "${HDF5_F90_C_TEST_LIB_CORENAME}-shared")
+set (HDF5_HL_F90_LIBSH_TARGET "${HDF5_HL_F90_LIB_CORENAME}-shared")
+set (HDF5_HL_F90_C_LIBSH_TARGET "${HDF5_HL_F90_C_LIB_CORENAME}-shared")
#-----------------------------------------------------------------------------
# Define some CMake variables for use later in the project
@@ -308,20 +320,15 @@ if (HDF5_BUILD_FRAMEWORKS AND NOT BUILD_SHARED_LIBS)
endif (HDF5_BUILD_FRAMEWORKS AND NOT BUILD_SHARED_LIBS)
#-----------------------------------------------------------------------------
-# Option to Build Shared/Static libs, default is static
+# Option to Build Shared and Static libs, default is static
#-----------------------------------------------------------------------------
-option (BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
-set (LIB_TYPE STATIC)
+option (BUILD_SHARED_LIBS "Build Shared Libraries" ON)
set (H5_ENABLE_SHARED_LIB NO)
-set (H5_ENABLE_STATIC_LIB NO)
if (BUILD_SHARED_LIBS)
- set (LIB_TYPE SHARED)
- set (H5_BUILT_AS_DYNAMIC_LIB 1)
set (H5_ENABLE_SHARED_LIB YES)
-else (BUILD_SHARED_LIBS)
- set (H5_BUILT_AS_STATIC_LIB 1)
- set (H5_ENABLE_STATIC_LIB YES)
+ set (LINK_SHARED_LIBS ${LINK_LIBS})
endif (BUILD_SHARED_LIBS)
+set (H5_ENABLE_STATIC_LIB YES)
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
#-----------------------------------------------------------------------------
@@ -471,6 +478,7 @@ endif (HDF5_ENABLE_PARALLEL)
# Parallel IO usage requires MPI to be Linked and Included
if (H5_HAVE_PARALLEL)
set (LINK_LIBS ${LINK_LIBS} ${MPI_C_LIBRARIES})
+ set (LINK_SHARED_LIBS ${LINK_SHARED_LIBS} ${MPI_C_LIBRARIES})
if (MPI_C_LINK_FLAGS)
set (CMAKE_EXE_LINKER_FLAGS "${MPI_C_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}")
endif (MPI_C_LINK_FLAGS)
@@ -571,9 +579,15 @@ add_subdirectory (${HDF5_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src)
if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
if (ZLIB_FOUND AND ZLIB_USE_EXTERNAL)
ADD_DEPENDENCIES (${HDF5_LIB_TARGET} ZLIB)
+ if (BUILD_SHARED_LIBS)
+ add_dependencies (${HDF5_LIBSH_TARGET} ZLIB)
+ endif (BUILD_SHARED_LIBS)
endif (ZLIB_FOUND AND ZLIB_USE_EXTERNAL)
if (SZIP_FOUND AND SZIP_USE_EXTERNAL)
ADD_DEPENDENCIES (${HDF5_LIB_TARGET} SZIP)
+ if (BUILD_SHARED_LIBS)
+ add_dependencies (${HDF5_LIBSH_TARGET} SZIP)
+ endif (BUILD_SHARED_LIBS)
endif (SZIP_FOUND AND SZIP_USE_EXTERNAL)
endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")