Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/cmake/modules/CheckProblematicConfigurations.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

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.

Copy link
Member Author

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

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.")
Expand Down
Loading