summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt58
1 files changed, 36 insertions, 22 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a171ad3..799c1da 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -87,6 +87,7 @@ endif ()
# # Add the sub project
# add_subdirectory (Utilities/hdf5-1.8)
#-----------------------------------------------------------------------------
+string(TIMESTAMP CONFIG_DATE "%Y-%m-%d")
#-----------------------------------------------------------------------------
# Allow Visual Studio solution directories
@@ -138,18 +139,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 +321,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 +479,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 +580,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")
@@ -707,7 +722,6 @@ endif (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++"
# Check if Fortran's default real is double precision. If it is and HL is
# being built then configure should fail due to bug HDFFV-889.
#-----------------------------------------------------------------------------
-
if (HDF5_BUILD_FORTRAN AND HDF5_BUILD_HL_LIB )
if (NOT FORTRAN_DEFAULT_REAL_NOT_DOUBLE)
message (FATAL_ERROR " **** Fortran high-level routines are not supported when the default REAL is DOUBLE PRECISION, use HDF5_BUILD_HL_LIB:BOOL=OFF **** ")