diff options
author | Brad King <brad.king@kitware.com> | 2022-11-29 15:06:42 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-11-29 15:06:52 (GMT) |
commit | 25f6f98eb19d3d4c4bf70b5ea3d68a0554e9f304 (patch) | |
tree | a9d1ef1e3933e2f68f884cb289a65a6757f91223 | |
parent | 90907c8ff96ff07f0dafc1f4904d25b1e10f014b (diff) | |
parent | b47092fddb51e2e89fa083af5c15fb6b81f35186 (diff) | |
download | CMake-25f6f98eb19d3d4c4bf70b5ea3d68a0554e9f304.zip CMake-25f6f98eb19d3d4c4bf70b5ea3d68a0554e9f304.tar.gz CMake-25f6f98eb19d3d4c4bf70b5ea3d68a0554e9f304.tar.bz2 |
Merge topic 'mingw-windres' into release-3.25
b47092fddb MinGW: Fix regression when windres is not found
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7964
-rw-r--r-- | Modules/CMakeDetermineRCCompiler.cmake | 15 | ||||
-rw-r--r-- | Modules/Platform/Windows-GNU.cmake | 3 |
2 files changed, 11 insertions, 7 deletions
diff --git a/Modules/CMakeDetermineRCCompiler.cmake b/Modules/CMakeDetermineRCCompiler.cmake index f8d55a5..d22741b 100644 --- a/Modules/CMakeDetermineRCCompiler.cmake +++ b/Modules/CMakeDetermineRCCompiler.cmake @@ -30,16 +30,19 @@ if(NOT CMAKE_RC_COMPILER) # finally list compilers to try if(CMAKE_RC_COMPILER_INIT) - set(CMAKE_RC_COMPILER_LIST ${CMAKE_RC_COMPILER_INIT}) - else() - set(CMAKE_RC_COMPILER_LIST rc) + set(_CMAKE_RC_COMPILER_LIST ${CMAKE_RC_COMPILER_INIT}) + set(_CMAKE_RC_COMPILER_FALLBACK ${CMAKE_RC_COMPILER_INIT}) + elseif(NOT _CMAKE_RC_COMPILER_LIST) + set(_CMAKE_RC_COMPILER_LIST rc) endif() # Find the compiler. - find_program(CMAKE_RC_COMPILER NAMES ${CMAKE_RC_COMPILER_LIST} DOC "RC compiler") - if(CMAKE_RC_COMPILER_INIT AND NOT CMAKE_RC_COMPILER) - set(CMAKE_RC_COMPILER "${CMAKE_RC_COMPILER_INIT}" CACHE FILEPATH "RC compiler" FORCE) + find_program(CMAKE_RC_COMPILER NAMES ${_CMAKE_RC_COMPILER_LIST} DOC "RC compiler") + if(_CMAKE_RC_COMPILER_FALLBACK AND NOT CMAKE_RC_COMPILER) + set(CMAKE_RC_COMPILER "${_CMAKE_RC_COMPILER_FALLBACK}" CACHE FILEPATH "RC compiler" FORCE) endif() + unset(_CMAKE_RC_COMPILER_FALLBACK) + unset(_CMAKE_RC_COMPILER_LIST) endif() mark_as_advanced(CMAKE_RC_COMPILER) diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index bf96e63..088b238 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -157,7 +157,8 @@ macro(__windows_compiler_gnu lang) endif() if(NOT CMAKE_RC_COMPILER_INIT AND NOT CMAKE_GENERATOR_RC) - set(CMAKE_RC_COMPILER_INIT ${_CMAKE_TOOLCHAIN_PREFIX}windres windres) + set(_CMAKE_RC_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}windres windres) + set(_CMAKE_RC_COMPILER_FALLBACK windres) endif() enable_language(RC) |