summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeRCInformation.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-06-27 11:39:24 (GMT)
committerBrad King <brad.king@kitware.com>2019-06-27 11:39:24 (GMT)
commitd2f20ab217c3e21bb573a3d4b1f90b1248f5b8b3 (patch)
tree0ed77c507626c76b20a0d87e7b66a5e7daa9be8f /Modules/CMakeRCInformation.cmake
parent79d27c06bc58b6a67d84636d8b96648052d93dfa (diff)
downloadCMake-d2f20ab217c3e21bb573a3d4b1f90b1248f5b8b3.zip
CMake-d2f20ab217c3e21bb573a3d4b1f90b1248f5b8b3.tar.gz
CMake-d2f20ab217c3e21bb573a3d4b1f90b1248f5b8b3.tar.bz2
RC: Honor CMAKE_USER_MAKE_RULES_OVERRIDE
Since the refactoring in commit 48f7e2d300 (Unhardcode the CMAKE_CONFIGURATION_TYPES values, 2017-11-27, v3.11.0-rc1~130^2~1), `CMAKE_BUILD_TYPE` is initialized while enabling the RC language. Therefore we need to honor `CMAKE_USER_MAKE_RULES_OVERRIDE` as part of enabling RC so that a `CMAKE_BUILD_TYPE_INIT` setting in the override file is honored. Fixes: #19401
Diffstat (limited to 'Modules/CMakeRCInformation.cmake')
-rw-r--r--Modules/CMakeRCInformation.cmake11
1 files changed, 11 insertions, 0 deletions
diff --git a/Modules/CMakeRCInformation.cmake b/Modules/CMakeRCInformation.cmake
index 7bf6567..7c3a5ab 100644
--- a/Modules/CMakeRCInformation.cmake
+++ b/Modules/CMakeRCInformation.cmake
@@ -17,6 +17,17 @@ set(CMAKE_SYSTEM_AND_RC_COMPILER_INFO_FILE
${CMAKE_ROOT}/Modules/Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}.cmake)
include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
+# This should be included before the _INIT variables are
+# used to initialize the cache. Since the rule variables
+# have if blocks on them, users can still define them here.
+# But, it should still be after the platform file so changes can
+# be made to those values.
+if(CMAKE_USER_MAKE_RULES_OVERRIDE)
+ # Save the full path of the file so try_compile can use it.
+ include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override)
+ set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}")
+endif()
+
set(CMAKE_RC_FLAGS_INIT "$ENV{RCFLAGS} ${CMAKE_RC_FLAGS_INIT}")
cmake_initialize_per_config_variable(CMAKE_RC_FLAGS "Flags for Windows Resource Compiler")