summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2024-03-04 14:53:52 (GMT)
committerGitHub <noreply@github.com>2024-03-04 14:53:52 (GMT)
commit7ce8c6f81abdc2d844bc12061239b05a983eda82 (patch)
tree7b99bf4bf746ec55f4175e0a49d2bb94048a172e /CMakeLists.txt
parent38c39381ece73afdcd881de2aaa76f8e9a057bd5 (diff)
downloadhdf5-7ce8c6f81abdc2d844bc12061239b05a983eda82.zip
hdf5-7ce8c6f81abdc2d844bc12061239b05a983eda82.tar.gz
hdf5-7ce8c6f81abdc2d844bc12061239b05a983eda82.tar.bz2
Add options to allow tools type selection and naming (#4046)
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt25
1 files changed, 17 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 29ce7e9..a2ebfcb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -482,7 +482,9 @@ set (H5_ENABLE_STATIC_LIB NO)
option (BUILD_SHARED_LIBS "Build Shared Libraries" ON)
set (H5_ENABLE_SHARED_LIB NO)
-# only shared libraries is true if user forces static OFF
+option (HDF5_BUILD_STATIC_TOOLS "Build Static Tools NOT Shared Tools" OFF)
+
+# only shared libraries/tools is true if user forces static OFF
if (NOT BUILD_STATIC_LIBS)
set (ONLY_SHARED_LIBS ON CACHE BOOL "Only Build Shared Libraries" FORCE)
endif ()
@@ -492,6 +494,15 @@ if (ONLY_SHARED_LIBS)
set (H5_ENABLE_STATIC_LIB NO)
set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries" FORCE)
set (BUILD_STATIC_LIBS OFF CACHE BOOL "Build Static Libraries" FORCE)
+ if (HDF5_BUILD_STATIC_TOOLS)
+ message (WARNING "Cannot build static tools without static libraries. Building shared tools.")
+ endif ()
+ set (HDF5_BUILD_STATIC_TOOLS OFF CACHE BOOL "Build Static Tools NOT Shared Tools" FORCE)
+endif ()
+
+if (NOT BUILD_SHARED_LIBS AND NOT HDF5_BUILD_STATIC_TOOLS)
+ message (VERBOSE "Cannot build shared tools without shared libraries. Building static tools.")
+ set (HDF5_BUILD_STATIC_TOOLS ON CACHE BOOL "Build Static Tools NOT Shared Tools" FORCE)
endif ()
if (BUILD_STATIC_LIBS)
@@ -503,12 +514,6 @@ endif ()
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
-if (NOT BUILD_SHARED_LIBS)
- set (tgt_file_ext "")
-else ()
- set (tgt_file_ext "-shared")
-endif ()
-
#-----------------------------------------------------------------------------
# perl is used in some optional src and tests, check availability
find_package (Perl)
@@ -1158,7 +1163,11 @@ endif ()
if (EXISTS "${HDF5_SOURCE_DIR}/java" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/java")
option (HDF5_BUILD_JAVA "Build Java HDF5 Library" OFF)
if (HDF5_BUILD_JAVA)
- add_subdirectory (java)
+ if (NOT BUILD_SHARED_LIBS)
+ message (FATAL_ERROR "\nJava requires shared libraries!\n")
+ else ()
+ add_subdirectory (java)
+ endif ()
endif ()
endif ()