From ee67dde9010a05bd1de8aa5dff4e9b0ef6bfd973 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Thu, 27 Mar 2025 22:33:54 +0000 Subject: [PATCH 1/2] [llvm][cmake] Quote CMAKE_CXX_COMPILER_ID in string comparison 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. --- llvm/cmake/modules/CheckProblematicConfigurations.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/cmake/modules/CheckProblematicConfigurations.cmake b/llvm/cmake/modules/CheckProblematicConfigurations.cmake index e133873d756c1..71484172cfb6d 100644 --- a/llvm/cmake/modules/CheckProblematicConfigurations.cmake +++ b/llvm/cmake/modules/CheckProblematicConfigurations.cmake @@ -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) string(TOLOWER "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}" _FLAGS) if(_FLAGS MATCHES "/arch:avx[0-9]*") log_problematic("Compiling LLVM with MSVC and the /arch:AVX flag is known to cause issues with parts of LLVM.\nSee https://github.com/llvm/llvm-project/issues/54645 for details.\nUse clang-cl if you want to enable AVX instructions.") From 1d9f84dd40d37deff9d00fa9712856a2de86709e Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Thu, 27 Mar 2025 23:08:23 +0000 Subject: [PATCH 2/2] fixup! swap the quotes --- llvm/cmake/modules/CheckProblematicConfigurations.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/cmake/modules/CheckProblematicConfigurations.cmake b/llvm/cmake/modules/CheckProblematicConfigurations.cmake index 71484172cfb6d..cf08ab266f33c 100644 --- a/llvm/cmake/modules/CheckProblematicConfigurations.cmake +++ b/llvm/cmake/modules/CheckProblematicConfigurations.cmake @@ -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") string(TOLOWER "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}" _FLAGS) if(_FLAGS MATCHES "/arch:avx[0-9]*") log_problematic("Compiling LLVM with MSVC and the /arch:AVX flag is known to cause issues with parts of LLVM.\nSee https://github.com/llvm/llvm-project/issues/54645 for details.\nUse clang-cl if you want to enable AVX instructions.")