-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[llvm][cmake] Quote CMAKE_CXX_COMPILER_ID in string comparison #133332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
We're seeing following configuration error when building the `runtimes` target on our buildbots: ``` CMake Error at /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-sanitized/llvm-project/llvm/cmake/modules/CheckProblematicConfigurations.cmake:14 (if): if given arguments: "STREQUAL" "MSVC" Unknown arguments specified Call Stack (most recent call first): /Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake-sanitized/llvm-project/llvm/cmake/modules/HandleLLVMOptions.cmake:10 (include) CMakeLists.txt:175 (include) ``` If I understand correctly this happens because ${CMAKE_CXX_COMPILER_ID} is empty. Quoting it should make the comparison work for those cases.
@@ -11,7 +11,7 @@ endmacro() | |||
|
|||
# MSVC and /arch:AVX is untested and have created problems before. See: | |||
# https://github.com/llvm/llvm-project/issues/54645 | |||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC) | |||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL MSVC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the error message, it's likely that CMAKE_CXX_COMPILER_ID
as a variable is empty or not defined. Expanding the variable here effectively turns this into if( STREQUAL MSVC)
, which is why the error complains about only seeing those two.
I would recommend changing your solution to:
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
. This makes it clear that the former is a variable and the latter is a string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! That seems to also be how we do it elsewhere in the codebase
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/15044 Here is the relevant piece of the build log for the reference
|
We're seeing following configuration error when building the
runtimes
target on our buildbots:If I understand correctly this happens because ${CMAKE_CXX_COMPILER_ID} is empty. Quoting it should make the comparison work for those cases.