summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt78
1 files changed, 57 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 33b4bca..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
@@ -170,6 +183,9 @@ if (NOT HDF5_INSTALL_BIN_DIR)
set (HDF5_INSTALL_BIN_DIR bin)
endif (NOT HDF5_INSTALL_BIN_DIR)
if (NOT HDF5_INSTALL_LIB_DIR)
+ if (APPLE)
+ set (HDF5_INSTALL_FMWK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
+ endif (APPLE)
set (HDF5_INSTALL_LIB_DIR lib)
endif (NOT HDF5_INSTALL_LIB_DIR)
if (NOT HDF5_INSTALL_INCLUDE_DIR)
@@ -177,6 +193,15 @@ if (NOT HDF5_INSTALL_INCLUDE_DIR)
endif (NOT HDF5_INSTALL_INCLUDE_DIR)
if (NOT HDF5_INSTALL_DATA_DIR)
if (NOT WIN32)
+ if (APPLE)
+ option (HDF5_BUILD_FRAMEWORKS "Create a Mac OSX Framework" OFF)
+ if (HDF5_BUILD_FRAMEWORKS)
+ set (HDF5_INSTALL_EXTRA_DIR ../SharedSupport)
+ else (HDF5_BUILD_FRAMEWORKS)
+ set (HDF5_INSTALL_EXTRA_DIR share)
+ endif (HDF5_BUILD_FRAMEWORKS)
+ set (HDF5_INSTALL_FWRK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX})
+ endif (APPLE)
set (HDF5_INSTALL_DATA_DIR share)
set (HDF5_INSTALL_CMAKE_DIR share/cmake)
else (NOT WIN32)
@@ -288,20 +313,23 @@ include (${HDF_RESOURCES_DIR}/ConfigureChecks.cmake)
set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
#-----------------------------------------------------------------------------
-# Option to Build Shared/Static libs, default is static
+# Mac OS X Options
#-----------------------------------------------------------------------------
-option (BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
-set (LIB_TYPE STATIC)
+option (HDF5_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" TRUE)
+if (HDF5_BUILD_FRAMEWORKS AND NOT BUILD_SHARED_LIBS)
+ set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries")
+endif (HDF5_BUILD_FRAMEWORKS AND NOT BUILD_SHARED_LIBS)
+
+#-----------------------------------------------------------------------------
+# Option to Build Shared and Static libs, default is 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)
#-----------------------------------------------------------------------------
@@ -451,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)
@@ -551,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")
@@ -638,6 +673,7 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for
endif (BUILD_SHARED_LIBS AND APPLE)
option (HDF5_ENABLE_F2003 "Enable FORTRAN 2003 Standard" ON)
include (${HDF_RESOURCES_EXT_DIR}/HDFUseFortran.cmake)
+ include (${HDF_RESOURCES_DIR}/HDF5UseFortran.cmake)
if (HDF5_ENABLE_F2003)
if (NOT FORTRAN_HAVE_ISO_C_BINDING)
set (HDF5_ENABLE_F2003 OFF)