diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2021-05-13 13:32:25 (GMT) |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2021-05-13 15:52:13 (GMT) |
commit | caea48eec966db7b5093bf85559b41da52eafd0e (patch) | |
tree | 40853fe921f871f0482455db5b3596da0459790a /Modules | |
parent | 96011ab06d8839010c181d501c58c8e914f3ba91 (diff) | |
download | CMake-caea48eec966db7b5093bf85559b41da52eafd0e.zip CMake-caea48eec966db7b5093bf85559b41da52eafd0e.tar.gz CMake-caea48eec966db7b5093bf85559b41da52eafd0e.tar.bz2 |
CMakeParseImplicitIncludeInfo: remove needless variable expansions
They seem to actually cause trouble, like an error reported on IRC where some
but not all CMake invocations may end up with an error like this:
CMake Warning (dev) at /usr/share/cmake/Modules/CMakeParseImplicitIncludeInfo.cmake:74 (if):
Policy CMP0054 is not set: Only interpret if() arguments as variables or
keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
Quoted keywords like ")" will no longer be interpreted as keywords when the
policy is set to NEW. Since the policy is not set the OLD behavior will be
used.
Call Stack (most recent call first):
/usr/share/cmake/Modules/CMakeParseImplicitIncludeInfo.cmake:179 (cmake_parse_implicit_include_line)
/usr/share/cmake/Modules/CMakeDetermineCompilerABI.cmake:119 (cmake_parse_implicit_include_info)
/usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)
CMakeLists.txt:24 (project)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Error at /usr/share/cmake/Modules/CMakeParseImplicitIncludeInfo.cmake:74 (if):
if given arguments:
"GNU" "STREQUAL" "SunPro" "AND" "(" ")" "MATCHES" "-D__SUNPRO_C" "OR" ")" "MATCHES" "-D__SUNPRO_F" ")"
I suspect that the line ends up being just ")", which then causes this error.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeParseImplicitIncludeInfo.cmake | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/Modules/CMakeParseImplicitIncludeInfo.cmake b/Modules/CMakeParseImplicitIncludeInfo.cmake index a8e6ac0..5c0eda2 100644 --- a/Modules/CMakeParseImplicitIncludeInfo.cmake +++ b/Modules/CMakeParseImplicitIncludeInfo.cmake @@ -12,9 +12,9 @@ function(cmake_parse_implicit_include_line line lang id_var log_var state_var) set(log "") # Cray compiler (from cray wrapper, via PrgEnv-cray) - if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "Cray" AND - "${line}" MATCHES "^/" AND "${line}" MATCHES "/ccfe |/ftnfe " AND - "${line}" MATCHES " -isystem| -I") + if(CMAKE_${lang}_COMPILER_ID STREQUAL "Cray" AND + line MATCHES "^/" AND line MATCHES "/ccfe |/ftnfe " AND + line MATCHES " -isystem| -I") string(REGEX MATCHALL " (-I ?|-isystem )(\"[^\"]+\"|[^ \"]+)" incs "${line}") foreach(inc IN LISTS incs) string(REGEX REPLACE " (-I ?|-isystem )(\"[^\"]+\"|[^ \"]+)" "\\2" idir "${inc}") @@ -28,12 +28,12 @@ function(cmake_parse_implicit_include_line line lang id_var log_var state_var) endif() # PGI compiler - if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "PGI") + if(CMAKE_${lang}_COMPILER_ID STREQUAL "PGI") # pgc++ verbose output differs - if(("${lang}" STREQUAL "C" OR "${lang}" STREQUAL "Fortran") AND - "${line}" MATCHES "^/" AND - "${line}" MATCHES "/pgc |/pgf901 |/pgftnc " AND - "${line}" MATCHES " -cmdline ") + if((lang STREQUAL "C" OR lang STREQUAL "Fortran") AND + line MATCHES "^/" AND + line MATCHES "/pgc |/pgf901 |/pgftnc " AND + line MATCHES " -cmdline ") # cmdline has unparsed cmdline, remove it string(REGEX REPLACE "-cmdline .*" "" line "${line}") if("${line}" MATCHES " -nostdinc ") @@ -51,14 +51,14 @@ function(cmake_parse_implicit_include_line line lang id_var log_var state_var) else() string(APPEND log " warning: PGI C/F parse failed!\n") endif() - elseif("${lang}" STREQUAL "CXX" AND "${line}" MATCHES "^/" AND - "${line}" MATCHES "/pggpp1 " AND "${line}" MATCHES " -I") + elseif(lang STREQUAL "CXX" AND line MATCHES "^/" AND + line MATCHES "/pggpp1 " AND line MATCHES " -I") # oddly, -Mnostdinc does not get rid of system -I's, at least in # PGI 18.10.1 ... string(REGEX MATCHALL " (-I ?)([^ ]*)" incs "${line}") foreach(inc IN LISTS incs) string(REGEX REPLACE " (-I ?)([^ ]*)" "\\2" idir "${inc}") - if(NOT "${idir}" STREQUAL "-") # filter out "-I-" + if(NOT idir STREQUAL "-") # filter out "-I-" list(APPEND rv "${idir}") endif() endforeach() @@ -71,8 +71,8 @@ function(cmake_parse_implicit_include_line line lang id_var log_var state_var) endif() # SunPro compiler - if("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "SunPro" AND - ("${line}" MATCHES "-D__SUNPRO_C" OR "${line}" MATCHES "-D__SUNPRO_F") ) + if(CMAKE_${lang}_COMPILER_ID STREQUAL "SunPro" AND + (line MATCHES "-D__SUNPRO_C" OR line MATCHES "-D__SUNPRO_F")) string(REGEX MATCHALL " (-I ?)([^ ]*)" incs "${line}") foreach(inc IN LISTS incs) string(REGEX REPLACE " (-I ?)([^ ]*)" "\\2" idir "${inc}") @@ -81,7 +81,7 @@ function(cmake_parse_implicit_include_line line lang id_var log_var state_var) endif() endforeach() if(rv) - if ("${lang}" STREQUAL "C" OR "${lang}" STREQUAL "CXX") + if (lang STREQUAL "C" OR lang STREQUAL "CXX") # /usr/include appears to be hardwired in list(APPEND rv "/usr/include") endif() @@ -92,24 +92,24 @@ function(cmake_parse_implicit_include_line line lang id_var log_var state_var) endif() # XL compiler - if(("${CMAKE_${lang}_COMPILER_ID}" STREQUAL "XL" - OR "${CMAKE_${lang}_COMPILER_ID}" STREQUAL "XLClang") - AND "${line}" MATCHES "^/" - AND ( ("${lang}" STREQUAL "Fortran" AND - "${line}" MATCHES "/xl[fF]entry " AND - "${line}" MATCHES "OSVAR\\([^ ]+\\)") + if((CMAKE_${lang}_COMPILER_ID STREQUAL "XL" + OR CMAKE_${lang}_COMPILER_ID STREQUAL "XLClang") + AND line MATCHES "^/" + AND ( (lang STREQUAL "Fortran" AND + line MATCHES "/xl[fF]entry " AND + line MATCHES "OSVAR\\([^ ]+\\)") OR - ( ("${lang}" STREQUAL "C" OR "${lang}" STREQUAL "CXX") AND - "${line}" MATCHES "/xl[cC]2?entry " AND - "${line}" MATCHES " -qosvar=") + ( (lang STREQUAL "C" OR lang STREQUAL "CXX") AND + line MATCHES "/xl[cC]2?entry " AND + line MATCHES " -qosvar=") ) ) # -qnostdinc cancels other stdinc flags, even if present string(FIND "${line}" " -qnostdinc" nostd) - if(NOT ${nostd} EQUAL -1) + if(NOT nostd EQUAL -1) set(rv "") # defined but empty string(APPEND log " got implicit includes via XL parser (nostdinc)\n") else() - if("${lang}" STREQUAL "CXX") + if(lang STREQUAL "CXX") string(REGEX MATCHALL " -qcpp_stdinc=([^ ]*)" std "${line}") string(REGEX MATCHALL " -qgcc_cpp_stdinc=([^ ]*)" gcc_std "${line}") else() |