From 4cc876540e8fa6c6344c0df64d669808c3727b86 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Wed, 25 Mar 2020 21:55:41 +0100 Subject: llvm-rc: Select preprocessor from active languages The llvm-rc preprocessor is selected according to the CMAKE_C_COMPILER_ID / CMAKE_CXX_COMPILER_ID which are only defined when the C or CXX language is active. --- Modules/Platform/Windows-Clang.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index 87ddfcd..bd639b3 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -135,9 +135,9 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" # Feed the preprocessed rc file to llvm-rc if(CMAKE_RC_COMPILER_INIT STREQUAL "llvm-rc") - if(DEFINED CMAKE_C_COMPILER) + if(DEFINED CMAKE_C_COMPILER_ID) set(CMAKE_RC_PREPROCESSOR CMAKE_C_COMPILER) - elseif(DEFINED CMAKE_CXX_COMPILER) + elseif(DEFINED CMAKE_CXX_COMPILER_ID) set(CMAKE_RC_PREPROCESSOR CMAKE_CXX_COMPILER) endif() if(DEFINED CMAKE_RC_PREPROCESSOR) -- cgit v0.12 From 2c724c3aea7ca028044cb845ff05cfeda1e50fc4 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Wed, 25 Mar 2020 21:49:37 +0100 Subject: llvm-rc: Write depfile to location specified by the generator Move the depfile flags to `CMAKE_DEPFILE_FLAGS_RC` so that they are only usedwith generators that use depfiles. Also switch to using the `` placeholder for the location of the depfile so that it goes where the generator expects. Fixes: #20493 --- Modules/Platform/Windows-Clang.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index bd639b3..c08bb41 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -141,7 +141,8 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" set(CMAKE_RC_PREPROCESSOR CMAKE_CXX_COMPILER) endif() if(DEFINED CMAKE_RC_PREPROCESSOR) - set(CMAKE_RC_COMPILE_OBJECT "${CMAKE_COMMAND} -E cmake_llvm_rc .pp <${CMAKE_RC_PREPROCESSOR}> -DRC_INVOKED -clang:-MD -clang:-MF -clang:.d -E -- /fo .pp") + set(CMAKE_DEPFILE_FLAGS_RC "-clang:-MD -clang:-MF -clang:") + set(CMAKE_RC_COMPILE_OBJECT "${CMAKE_COMMAND} -E cmake_llvm_rc .pp <${CMAKE_RC_PREPROCESSOR}> -DRC_INVOKED -E -- /fo .pp") if(CMAKE_GENERATOR STREQUAL "Ninja") set(CMAKE_NINJA_CMCLDEPS_RC 0) set(CMAKE_NINJA_DEP_TYPE_RC gcc) -- cgit v0.12