diff options
author | Michel Zou <xantares09@hotmail.com> | 2020-10-30 09:44:24 (GMT) |
---|---|---|
committer | Michel Zou <xantares09@hotmail.com> | 2020-10-31 09:31:38 (GMT) |
commit | 7259b5eb7ac291f00cc989a44c5fe4964759efaf (patch) | |
tree | 805715ed48133b0127a15185f85b5f74f42d364d /c++ | |
parent | d8b7b3593b0727acade59ebddf4c749ea774ae2a (diff) | |
download | hdf5-7259b5eb7ac291f00cc989a44c5fe4964759efaf.zip hdf5-7259b5eb7ac291f00cc989a44c5fe4964759efaf.tar.gz hdf5-7259b5eb7ac291f00cc989a44c5fe4964759efaf.tar.bz2 |
CMake: Add an option to opt-out static libgcc
With sjlj exception model, statically link to libgcc/libstdc++
prevents exceptions to be caught from other dynamic libraries.
Diffstat (limited to 'c++')
-rw-r--r-- | c++/examples/CMakeLists.txt | 4 | ||||
-rw-r--r-- | c++/src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | c++/test/CMakeLists.txt | 2 |
3 files changed, 4 insertions, 4 deletions
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++ ) |