From 1e39fdab599b06632664c64554ec0ed9dc8b307f Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Wed, 16 Dec 2020 18:53:04 -0600 Subject: [PATCH] CMake: fix FIND_SYSTEM_LIBRARY --- cmake/macros/macro_enable_if_supported.cmake | 16 ---------------- cmake/macros/macro_find_system_library.cmake | 6 +++--- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/cmake/macros/macro_enable_if_supported.cmake b/cmake/macros/macro_enable_if_supported.cmake index 996eaa6cb3..1b86b58292 100644 --- a/cmake/macros/macro_enable_if_supported.cmake +++ b/cmake/macros/macro_enable_if_supported.cmake @@ -22,22 +22,6 @@ # MACRO(ENABLE_IF_SUPPORTED _variable _flag) - # - # For CMake prior to 3.19: - # - # Old clang versions are too conservative when reporting unsupported - # compiler flags. Therefore, we promote all warnings for an unsupported - # compiler flag to actual errors with the -Werror switch: - # - # Note: For cmake-3.19 onwards the supplied compiler flag must be a - # single flag. See https://github.com/dealii/dealii/issues/11272 - # - IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_VERSION VERSION_LESS 3.19) - SET(_werror_string "-Werror ") - ELSE() - SET(_werror_string "") - ENDIF() - STRING(STRIP "${_flag}" _flag_stripped) # diff --git a/cmake/macros/macro_find_system_library.cmake b/cmake/macros/macro_find_system_library.cmake index 945edda850..7c562a5bd4 100644 --- a/cmake/macros/macro_find_system_library.cmake +++ b/cmake/macros/macro_find_system_library.cmake @@ -26,10 +26,10 @@ MACRO(FIND_SYSTEM_LIBRARY) LIST(GET _argn 0 _variable) LIST(REMOVE_AT _argn 0 1) - if("${_variable}" MATCHES "^${_variable}$") + IF(NOT DEFINED ${_variable}) FOREACH(_arg ${_argn}) - LIST(APPEND CMAKE_REQUIRED_LIBRARIES "-l${_arg}") - CHECK_CXX_COMPILER_FLAG("" ${_variable}) + LIST(APPEND CMAKE_REQUIRED_LIBRARIES "${_arg}") + CHECK_CXX_SOURCE_COMPILES("int main(){}" ${_variable}) RESET_CMAKE_REQUIRED() IF(${_variable}) -- 2.39.5