From fc550202c28cea0ac2fd4a4182a6585fa01a0eca Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 4 Oct 2023 09:10:57 -0700 Subject: Disable static + thread-safe on Windows w/ CMake (#3622) (#3631) * Disable static + thread-safe on Windows w/ CMake (#3622) The thread-safety feature on Windows requires a hook in DllMain() and thus is only available when HDF5 is built as a shared library. This was previously a warning, but has now been elevated to a fatal error that cannot be overridden with ALLOW_UNSUPPORTED. Fixes GitHub #3613 --- .github/workflows/main.yml | 2 ++ CMakeLists.txt | 5 ++--- release_docs/RELEASE.txt | 11 +++++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 10b3a9c..031783b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -455,6 +455,7 @@ jobs: if: (matrix.generator != 'autogen') && ! (matrix.thread_safety.enabled) + # NOTE: Windows does not support static + thread-safe - name: CMake Configure (Thread-Safe) run: | mkdir "${{ runner.workspace }}/build" @@ -464,6 +465,7 @@ jobs: -DCMAKE_BUILD_TYPE=${{ matrix.build_mode.cmake }} \ -DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain }} \ -DBUILD_SHARED_LIBS=ON \ + -DBUILD_STATIC_LIBS=OFF \ -DHDF5_ENABLE_ALL_WARNINGS=ON \ -DHDF5_ENABLE_THREADSAFE:BOOL=ON \ -DHDF5_ENABLE_PARALLEL:BOOL=${{ matrix.parallel }} \ diff --git a/CMakeLists.txt b/CMakeLists.txt index 28fe23d..ad2c9d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -820,9 +820,8 @@ option (HDF5_ENABLE_THREADSAFE "Enable thread-safety" OFF) if (HDF5_ENABLE_THREADSAFE) # check for unsupported options if (WIN32) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE " **** thread-safety option not supported with static library **** ") - message (VERBOSE " **** thread-safety option will not be used building static library **** ") + if (BUILD_STATIC_LIBS) + message (FATAL_ERROR " **** thread-safety option not supported with static library **** ") endif () endif () if (HDF5_ENABLE_PARALLEL) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 4287fcf..b5f8acb 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -47,6 +47,17 @@ New Features Configuration: ------------- + - Thread-safety + static library disabled on Windows w/ CMake + + The thread-safety feature requires hooks in DllMain(), which is only + present in the shared library. + + We previously just warned about this, but now any CMake configuration + that tries to build thread-safety and the static library will fail. + This cannot be overridden with ALLOW_UNSUPPORTED. + + Fixes GitHub issue #3613 + - Bumped the minimum required version of Autoconf to 2.71. This fixes a problem with the Intel oneAPI Fortran compiler's -loopopt -- cgit v0.12