summaryrefslogtreecommitdiffstats
path: root/Modules/Platform
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-03-28 17:04:37 (GMT)
committerBrad King <brad.king@kitware.com>2017-03-28 17:10:56 (GMT)
commitfff34934e70da77c359e47c53ffd04701bcd7611 (patch)
tree7ceaf11aa38451544552ccc3b3aff6023a5f8a4c /Modules/Platform
parent79a915383fd0c0e55bf0ca5fe5b3cf07d1823aa7 (diff)
downloadCMake-fff34934e70da77c359e47c53ffd04701bcd7611.zip
CMake-fff34934e70da77c359e47c53ffd04701bcd7611.tar.gz
CMake-fff34934e70da77c359e47c53ffd04701bcd7611.tar.bz2
MSVC: Restore _DEBUG preprocessor definition in RC debug builds
In commit v3.8.0-rc1~304^2 (MSVC: Do not define _DEBUG explicitly when using /MDd, 2016-11-15) we removed the `_DEBUG` preprocessor definition from MSVC C and C++ flags because the `cl` compiler automatically defines it in Debug builds anyway. However, the VS generators propagate C preprocessor definitions to the RC (Windows Resource Compiler) tool. This means that we used to explicitly define `_DEBUG` for RC debug builds. Therefore existing project code may expect the definition to be there even though the `rc` compiler itself does not implicitly define `_DEBUG` in debug builds. Add the `_DEBUG` flag to the default `CMAKE_RC_FLAGS_DEBUG` instead to restore this definition for RC debug builds. This also makes it available consistently in VS, Ninja, and Makefile generators. Fixes: #16745
Diffstat (limited to 'Modules/Platform')
-rw-r--r--Modules/Platform/Windows-MSVC.cmake3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 31b26b5..e4aca6e 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -310,6 +310,9 @@ macro(__windows_compiler_msvc lang)
if(NOT CMAKE_RC_FLAGS_INIT)
string(APPEND CMAKE_RC_FLAGS_INIT " ${_PLATFORM_DEFINES} ${_PLATFORM_DEFINES_${lang}}")
endif()
+ if(NOT CMAKE_RC_FLAGS_DEBUG_INIT)
+ string(APPEND CMAKE_RC_FLAGS_DEBUG_INIT " /D_DEBUG")
+ endif()
enable_language(RC)
set(CMAKE_NINJA_CMCLDEPS_RC 1)