From: Matthias Maier Date: Thu, 17 Dec 2020 00:53:04 +0000 (-0600) Subject: CMake: fix FIND_SYSTEM_LIBRARY X-Git-Tag: v9.3.0-rc1~749^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e39fdab599b06632664c64554ec0ed9dc8b307f;p=dealii.git CMake: fix FIND_SYSTEM_LIBRARY --- 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})