]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: fix FIND_SYSTEM_LIBRARY
authorMatthias Maier <tamiko@43-1.org>
Thu, 17 Dec 2020 00:53:04 +0000 (18:53 -0600)
committerMatthias Maier <tamiko@43-1.org>
Thu, 17 Dec 2020 02:13:58 +0000 (20:13 -0600)
cmake/macros/macro_enable_if_supported.cmake
cmake/macros/macro_find_system_library.cmake

index 996eaa6cb38fbd2135570718b8d0d9a290c4ef5e..1b86b582923e4082428149de33f13fa894a95294 100644 (file)
 #
 
 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)
 
   #
index 945edda850fb925e4dc4573726b8d65cf0227b19..7c562a5bd4f4367de257940e4bae545deac6aed1 100644 (file)
@@ -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})

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.