From 6d5f8dcab59c8b5df1292aef5b725d36de136699 Mon Sep 17 00:00:00 2001 From: Marcus Holland-Moritz Date: Tue, 6 Feb 2024 08:03:40 +0100 Subject: [PATCH] build: --as-needed doesn't work well for us with BUILD_SHARED_LIBS --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b24d7fad..0a9bd352 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -305,8 +305,8 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") set(MSVC_USE_STATIC_RUNTIME ON CACHE BOOL "static build") else() - if(CMAKE_EXE_LINKER_FLAGS MATCHES "--as-needed") - message(FATAL_ERROR "DwarFS cannot be built with --as-needed") + if(BUILD_SHARED_LIBS AND CMAKE_EXE_LINKER_FLAGS MATCHES "--as-needed") + message(FATAL_ERROR "DwarFS cannot be built with `BUILD_SHARED_LIBS` and `--as-needed` enabled simultaneously.") endif() endif()