Skip to content

Commit 7a92fb7

Browse files
KyleFromKitwarekwrobot
authored andcommitted
Merge topic 'clang-llvm-rc'
cea253a Clang: Fall back to llvm-rc when rc is unavailable Acked-by: Kitware Robot <[email protected]> Acked-by: Ben Boeckel <[email protected]> Merge-request: !3687
2 parents 2beed5a + cea253a commit 7a92fb7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Modules/Platform/Windows-Clang.cmake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,21 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC"
9999
"or clang-cl as both C and C++ compilers.")
100100
endif()
101101

102+
if(NOT CMAKE_RC_COMPILER_INIT)
103+
# Check if rc is already in the path
104+
# This may happen in cases where the user is already in a visual studio environment when CMake is invoked
105+
find_program(__RC_COMPILER_PATH NAMES rc)
106+
107+
# Default to rc if it's available, otherwise fall back to llvm-rc
108+
if(__RC_COMPILER_PATH)
109+
set(CMAKE_RC_COMPILER_INIT rc)
110+
else()
111+
set(CMAKE_RC_COMPILER_INIT llvm-rc)
112+
endif()
113+
114+
unset(__RC_COMPILER_PATH CACHE)
115+
endif()
116+
102117
if ( "x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC" OR "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC" )
103118
include(Platform/Windows-MSVC)
104119

0 commit comments

Comments
 (0)