summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2020-11-02 13:44:44 (GMT)
committerGitHub <noreply@github.com>2020-11-02 13:44:44 (GMT)
commitdc47bb7084d55993a0a6f3725dcf79d92d7f0e65 (patch)
treeb9dc4be8a9b87d3b21057d63b533e43d47ed643e
parent3c42c49a02227a4d43504d9da7cf3df5b34f98ee (diff)
parent7259b5eb7ac291f00cc989a44c5fe4964759efaf (diff)
downloadhdf5-dc47bb7084d55993a0a6f3725dcf79d92d7f0e65.zip
hdf5-dc47bb7084d55993a0a6f3725dcf79d92d7f0e65.tar.gz
hdf5-dc47bb7084d55993a0a6f3725dcf79d92d7f0e65.tar.bz2
Merge pull request #69 from xantares/mingw3
CMake: Add an option to opt-out static libgcc
-rw-r--r--CMakeLists.txt2
-rw-r--r--c++/examples/CMakeLists.txt4
-rw-r--r--c++/src/CMakeLists.txt2
-rw-r--r--c++/test/CMakeLists.txt2
-rw-r--r--config/cmake/cacheinit.cmake2
-rw-r--r--release_docs/INSTALL_CMake.txt1
-rw-r--r--release_docs/RELEASE.txt7
7 files changed, 16 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 01355dd..43088b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -579,6 +579,8 @@ if (WIN32)
endif ()
endif ()
+option (HDF5_MINGW_STATIC_GCC_LIBS "Statically link libgcc/libstdc++" OFF)
+
if (MSVC)
set (CMAKE_MFC_FLAG 0)
set (WIN_COMPILE_FLAGS "")
diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt
index 3035841..c50315f 100644
--- a/c++/examples/CMakeLists.txt
+++ b/c++/examples/CMakeLists.txt
@@ -41,7 +41,7 @@ foreach (example ${examples})
else ()
TARGET_C_PROPERTIES (cpp_ex_${example} SHARED)
target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- if (MINGW)
+ if (MINGW AND HDF5_MINGW_STATIC_GCC_LIBS)
target_link_options (${HDF5_CPP_LIBSH_TARGET}
PRIVATE -static-libgcc -static-libstdc++
)
@@ -66,7 +66,7 @@ foreach (example ${tutr_examples})
else ()
TARGET_C_PROPERTIES (cpp_ex_${example} SHARED)
target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
- if (MINGW)
+ if (MINGW AND HDF5_MINGW_STATIC_GCC_LIBS)
target_link_options (${HDF5_CPP_LIBSH_TARGET}
PRIVATE -static-libgcc -static-libstdc++
)
diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt
index 04822cf..de2306e 100644
--- a/c++/src/CMakeLists.txt
+++ b/c++/src/CMakeLists.txt
@@ -117,7 +117,7 @@ if (BUILD_SHARED_LIBS)
target_link_libraries (${HDF5_CPP_LIBSH_TARGET}
PUBLIC ${HDF5_LIBSH_TARGET}
)
- if (MINGW)
+ if (MINGW AND HDF5_MINGW_STATIC_GCC_LIBS)
target_link_options (${HDF5_CPP_LIBSH_TARGET}
PRIVATE -static-libgcc -static-libstdc++
)
diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt
index 550b7ea..1255e39 100644
--- a/c++/test/CMakeLists.txt
+++ b/c++/test/CMakeLists.txt
@@ -49,7 +49,7 @@ if (NOT BUILD_SHARED_LIBS)
else ()
TARGET_C_PROPERTIES (cpp_testhdf5 SHARED)
target_link_libraries (cpp_testhdf5 PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET})
- if (MINGW)
+ if (MINGW AND HDF5_MINGW_STATIC_GCC_LIBS)
target_link_options (${HDF5_CPP_LIBSH_TARGET}
PRIVATE -static-libgcc -static-libstdc++
)
diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake
index f8ab3a2..71c8b4a 100644
--- a/config/cmake/cacheinit.cmake
+++ b/config/cmake/cacheinit.cmake
@@ -40,6 +40,8 @@ set (HDF5_ENABLE_ALL_WARNINGS ON CACHE BOOL "Enable all warnings" FORCE)
set (HDF_TEST_EXPRESS "2" CACHE STRING "Control testing framework (0-3)" FORCE)
+set (HDF5_MINGW_STATIC_GCC_LIBS ON CACHE BOOL "Statically link libgcc/libstdc++" FORCE)
+
set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library Building (NO GIT TGZ)" FORCE)
set_property (CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO GIT TGZ)
diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt
index ed27bb2..89d3ac0 100644
--- a/release_docs/INSTALL_CMake.txt
+++ b/release_docs/INSTALL_CMake.txt
@@ -778,6 +778,7 @@ HDF5_WANT_DATA_ACCURACY "IF data accuracy is guaranteed during data conve
HDF5_WANT_DCONV_EXCEPTION "exception handling functions is checked during data conversions" ON
HDF5_ENABLE_THREADSAFE "Enable Threadsafety" OFF
HDF5_MSVC_NAMING_CONVENTION "Use MSVC Naming conventions for Shared Libraries" OFF
+HDF5_MINGW_STATIC_GCC_LIBS "Statically link libgcc/libstdc++" OFF
if (APPLE)
HDF5_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF
if (CMAKE_BUILD_TYPE MATCHES Debug)
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 70af053..43356527 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -54,6 +54,13 @@ New Features
when using a MinGW toolchain
(xan - 2020/10/30)
+
+ - CMake option to statically link gcc libs with MinGW
+
+ HDF5_MINGW_STATIC_GCC_LIBS allows to statically link libg/libstdc++
+ with the MinGW toolchain
+
+ (xan - 2020/10/30)
- CMake option to build the HDF filter plugins project as an external project