mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 02:39:48 -06:00
ASM: Restore CMAKE_{C,CXX}_COMPILER as ASM-first candidates
Prior to commitabfe98ce6c(ASM: Consider C/CXX compilers only if enabled, 2025-04-08) one could pass `-DCMAKE_C_COMPILER=...` to configure a project that enables `ASM` before/without `C` or `CXX`. This was previously allowed accidentally as a side effect of the way we implemented support for using the selected `C` or `CXX` compiler for `ASM`. Restore it for compatibility, but also preserve the effect of commit6baf65ec46(ASM: Do not consider MSVC C/CXX compiler for generic ASM, 2025-04-08) by excluding `cl`.
This commit is contained in:
@@ -23,8 +23,12 @@ if(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
|
||||
if(NOT CMAKE_ASM_COMPILER_INIT)
|
||||
if(CMAKE_C_COMPILER_LOADED AND NOT CMAKE_C_COMPILER_ID MATCHES "^(MSVC)$")
|
||||
set(CMAKE_ASM_COMPILER_LIST ${CMAKE_C_COMPILER})
|
||||
elseif(NOT CMAKE_C_COMPILER_LOADED AND CMAKE_C_COMPILER AND NOT CMAKE_C_COMPILER MATCHES "(^|/)[Cc][Ll](\\.|$)")
|
||||
set(CMAKE_ASM_COMPILER_LIST ${CMAKE_C_COMPILER})
|
||||
elseif(CMAKE_CXX_COMPILER_LOADED AND NOT CMAKE_CXX_COMPILER_ID MATCHES "^(MSVC)$")
|
||||
set(CMAKE_ASM_COMPILER_LIST ${CMAKE_CXX_COMPILER})
|
||||
elseif(NOT CMAKE_CXX_COMPILER_LOADED AND CMAKE_CXX_COMPILER AND NOT CMAKE_CXX_COMPILER MATCHES "(^|/)[Cc][Ll](\\.|$)")
|
||||
set(CMAKE_ASM_COMPILER_LIST ${CMAKE_CXX_COMPILER})
|
||||
else()
|
||||
# List all default C and CXX compilers
|
||||
set(CMAKE_ASM_COMPILER_LIST
|
||||
|
||||
Reference in New Issue
Block a user