summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt101
1 files changed, 64 insertions, 37 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a09ab1a..1cacc5d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,24 @@ PROJECT (HDF5 C CXX)
# set CMAKE_INSTALL_PREFIX to the required install path.
# Make install can be used to install all components for system-wide use.
#
+if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+ MESSAGE(FATAL_ERROR "\nERROR! ${PROJECT_NAME} DOES NOT SUPPORT IN SOURCE BUILDS!\n"
+ "CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}"
+ " == CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}\n"
+ "NEXT STEPS:\n"
+ "(1) Delete the CMakeCache.txt file and the CMakeFiles/ directory\n"
+ " under the source directory for ${PROJECT_NAME}, otherwise you\n"
+ " will not be able to configure ${PROJECT_NAME} correctly!\n"
+ " * For example, on linux machines do:\n"
+ " $ rm -r CMakeCache.txt CMakeFiles/\n"
+ "(2) Create a different directory and configure ${PROJECT_NAME} in that directory.\n"
+ " * For example, on linux machines do:\n"
+ " $ mkdir MY_BUILD\n"
+ " $ cd MY_BUILD\n"
+ " $ cmake [OPTIONS] ..\n"
+ )
+endif ()
+
#-----------------------------------------------------------------------------
# Instructions for use : Sub-Project Build
#
@@ -283,8 +301,8 @@ if (BUILD_SHARED_LIBS)
else (BUILD_SHARED_LIBS)
set (H5_BUILT_AS_STATIC_LIB 1)
set (H5_ENABLE_STATIC_LIB YES)
- set (CMAKE_POSITION_INDEPENDENT_CODE ON)
endif (BUILD_SHARED_LIBS)
+set (CMAKE_POSITION_INDEPENDENT_CODE ON)
#-----------------------------------------------------------------------------
# Option to Build Static executables
@@ -369,10 +387,11 @@ endif (MAKE_SYSTEM)
#-----------------------------------------------------------------------------
# Add some definitions for Debug Builds
#-----------------------------------------------------------------------------
+option (HDF5_ENABLE_TRACE "Enable API tracing capability" OFF)
+mark_as_advanced (HDF5_ENABLE_TRACE)
if (CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions (-DDEBUG)
# Enable tracing of the API
- option (HDF5_ENABLE_TRACE "Enable API tracing capability" ON)
if (HDF5_ENABLE_TRACE)
add_definitions (-DH5_DEBUG_API )
endif (HDF5_ENABLE_TRACE)
@@ -381,14 +400,13 @@ if (CMAKE_BUILD_TYPE MATCHES Debug)
if (HDF5_ENABLE_INSTRUMENT)
set (H5_HAVE_INSTRUMENTED_LIBRARY 1)
endif (HDF5_ENABLE_INSTRUMENT)
- mark_as_advanced (HDF5_Enable_Instrument)
+ mark_as_advanced (HDF5_ENABLE_INSTRUMENT)
#-- NMake Makefiles will overwhelm the console with warnings if -Wall is used.
if (NOT WIN32)
add_definitions (-Wall)
endif (NOT WIN32)
else (CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions (-DNDEBUG)
- option (HDF5_ENABLE_TRACE "Enable API tracing capability" OFF)
if (HDF5_ENABLE_TRACE)
add_definitions (-DH5_DEBUG_API )
endif (HDF5_ENABLE_TRACE)
@@ -685,6 +703,9 @@ endif (HDF5_USE_18_API_DEFAULT)
#-----------------------------------------------------------------------------
include (UserMacros.cmake)
+#-----------------------------------------------------------------------------
+# Include filter (zlib, szip, etc.) macros
+#-----------------------------------------------------------------------------
include (CMakeFilters.cmake)
#-----------------------------------------------------------------------------
@@ -760,7 +781,7 @@ endif (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT
#-----------------------------------------------------------------------------
# Dashboard and Testing Settings
#-----------------------------------------------------------------------------
-option (BUILD_TESTING "Build HDF5 Unit Testing" OFF)
+option (BUILD_TESTING "Build HDF5 Unit Testing" ON)
if (BUILD_TESTING)
set (DART_TESTING_TIMEOUT 1200
CACHE INTEGER
@@ -792,6 +813,37 @@ if (BUILD_TESTING)
endif (BUILD_TESTING)
#-----------------------------------------------------------------------------
+# Option to build HDF5 Tools
+#-----------------------------------------------------------------------------
+if (EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools")
+ option (HDF5_BUILD_TOOLS "Build HDF5 Tools" ON)
+ if (HDF5_BUILD_TOOLS)
+ add_subdirectory (${HDF5_SOURCE_DIR}/tools ${PROJECT_BINARY_DIR}/tools)
+ endif (HDF5_BUILD_TOOLS)
+endif (EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools")
+
+#-----------------------------------------------------------------------------
+# Option to build examples
+#-----------------------------------------------------------------------------
+if (EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples")
+ option (HDF5_BUILD_EXAMPLES "Build HDF5 Library Examples" ON)
+ if (HDF5_BUILD_EXAMPLES)
+ add_subdirectory (${HDF5_SOURCE_DIR}/examples ${PROJECT_BINARY_DIR}/examples)
+ endif (HDF5_BUILD_EXAMPLES)
+endif (EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples")
+
+#-----------------------------------------------------------------------------
+# Option to build High Level API's
+#-----------------------------------------------------------------------------
+if (EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl")
+ option (HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" ON)
+ if (HDF5_BUILD_HL_LIB)
+ set (H5_INCLUDE_HL 1)
+ add_subdirectory (${HDF5_SOURCE_DIR}/hl ${PROJECT_BINARY_DIR}/hl)
+ endif (HDF5_BUILD_HL_LIB)
+endif (EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl")
+
+#-----------------------------------------------------------------------------
# Option to build Fortran bindings/tests/examples
# Make sure this appears before the CONFIGURE_FILE step
# so that fortran name mangling is detected before writing H5pubconf.h
@@ -829,20 +881,10 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for
endif (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran")
#-----------------------------------------------------------------------------
-# Option to build examples
-#-----------------------------------------------------------------------------
-if (EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples")
- option (HDF5_BUILD_EXAMPLES "Build HDF5 Library Examples" OFF)
- if (HDF5_BUILD_EXAMPLES)
- add_subdirectory (${HDF5_SOURCE_DIR}/examples ${PROJECT_BINARY_DIR}/examples)
- endif (HDF5_BUILD_EXAMPLES)
-endif (EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples")
-
-#-----------------------------------------------------------------------------
# Option to build HDF5 C++ Library
#-----------------------------------------------------------------------------
if (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++")
- option (HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" OFF)
+ option (HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" ON)
if (HDF5_BUILD_CPP_LIB)
# check for unsupported options
if (HDF5_ENABLE_PARALLEL)
@@ -852,31 +894,16 @@ if (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++")
set (H5_NO_STD 1)
endif (CMAKE_NO_STD_NAMESPACE)
add_subdirectory (${HDF5_SOURCE_DIR}/c++ ${PROJECT_BINARY_DIR}/c++)
+ if (HDF5_BUILD_HL_LIB)
+ if (EXISTS "${HDF5_SOURCE_DIR}/hl/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/c++")
+ #-- Build the High Level Fortran source codes
+ add_subdirectory (${HDF5_SOURCE_DIR}/hl/c++ ${PROJECT_BINARY_DIR}/hl/c++)
+ endif (EXISTS "${HDF5_SOURCE_DIR}/hl/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/c++")
+ endif (HDF5_BUILD_HL_LIB)
endif (HDF5_BUILD_CPP_LIB)
endif (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++")
#-----------------------------------------------------------------------------
-# Option to build HDF5 Tools
-#-----------------------------------------------------------------------------
-if (EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools")
- option (HDF5_BUILD_TOOLS "Build HDF5 Tools" OFF)
- if (HDF5_BUILD_TOOLS)
- add_subdirectory (${HDF5_SOURCE_DIR}/tools ${PROJECT_BINARY_DIR}/tools)
- endif (HDF5_BUILD_TOOLS)
-endif (EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools")
-
-#-----------------------------------------------------------------------------
-# Option to build High Level API's
-#-----------------------------------------------------------------------------
-if (EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl")
- option (HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" OFF)
- if (HDF5_BUILD_HL_LIB)
- set (H5_INCLUDE_HL 1)
- add_subdirectory (${HDF5_SOURCE_DIR}/hl ${PROJECT_BINARY_DIR}/hl)
- endif (HDF5_BUILD_HL_LIB)
-endif (EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl")
-
-#-----------------------------------------------------------------------------
# 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.
#-----------------------------------------------------------------------------