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()