diff options
author | Thomas Bernard <tbernard@go-engineering.de> | 2020-01-14 10:31:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-02-04 13:19:12 (GMT) |
commit | 1c2d031cbdbf28f99ef36e5db5e4d9de1b97fff9 (patch) | |
tree | b987d5cf32bdf9b094f830e0e7c91112709301c8 /Modules/Platform/Windows-Clang.cmake | |
parent | 5f04dfe57ebf1abee29101228844ebaa721356a2 (diff) | |
download | CMake-1c2d031cbdbf28f99ef36e5db5e4d9de1b97fff9.zip CMake-1c2d031cbdbf28f99ef36e5db5e4d9de1b97fff9.tar.gz CMake-1c2d031cbdbf28f99ef36e5db5e4d9de1b97fff9.tar.bz2 |
Add -E cmake_llvm_rc to preprocess files for llvm-rc
llvm-rc requires preprocessed rc files. The CMake command line tool
cmake_llvm_rc enables channing the preprocessor call and the resource
compiler and make this appear as single compilation step.
When llvm-rc is detected as resource compiler, the RC compilation step
is set to use this command.
Diffstat (limited to 'Modules/Platform/Windows-Clang.cmake')
-rw-r--r-- | Modules/Platform/Windows-Clang.cmake | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index 5eddd04..7fd5e49 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -133,6 +133,23 @@ if("x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC" if ( "x${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC" OR "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC" ) include(Platform/Windows-MSVC) + # Feed the preprocessed rc file to llvm-rc + if(CMAKE_RC_COMPILER_INIT STREQUAL "llvm-rc") + if(DEFINED CMAKE_C_COMPILER) + set(CMAKE_RC_PREPROCESSOR CMAKE_C_COMPILER) + elseif(DEFINED CMAKE_CXX_COMPILER) + set(CMAKE_RC_PREPROCESSOR CMAKE_CXX_COMPILER) + endif() + if(DEFINED CMAKE_RC_PREPROCESSOR) + set(CMAKE_RC_COMPILE_OBJECT "${CMAKE_COMMAND} -E cmake_llvm_rc <OBJECT>.pp <${CMAKE_RC_PREPROCESSOR}> <DEFINES> -DRC_INVOKED <INCLUDES> <FLAGS> -clang:-MD -clang:-MF -clang:<SOURCE>.d -E <SOURCE> -- <CMAKE_RC_COMPILER> <FLAGS> /fo <OBJECT> <OBJECT>.pp") + if(CMAKE_GENERATOR STREQUAL "Ninja") + set(CMAKE_NINJA_CMCLDEPS_RC 0) + set(CMAKE_NINJA_DEP_TYPE_RC gcc) + endif() + unset(CMAKE_RC_PREPROCESSOR) + endif() + endif() + macro(__windows_compiler_clang lang) set(_COMPILE_${lang} "${_COMPILE_${lang}_MSVC}") __windows_compiler_msvc(${lang}) |