diff options
author | Brad King <brad.king@kitware.com> | 2017-03-28 17:00:59 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-03-28 17:10:55 (GMT) |
commit | c77194ec471dd4f039c0c30e05f0b519ab44bc14 (patch) | |
tree | a63317f321c534b910ddfe0f4f1a1f1f1b8a6ac3 /Source/cmVisualStudio10TargetGenerator.cxx | |
parent | 1449f6f63d09f21203b36b3485dd3eb60c73ac17 (diff) | |
download | CMake-c77194ec471dd4f039c0c30e05f0b519ab44bc14.zip CMake-c77194ec471dd4f039c0c30e05f0b519ab44bc14.tar.gz CMake-c77194ec471dd4f039c0c30e05f0b519ab44bc14.tar.bz2 |
VS: Honor preprocessor definitions in RC flags
The VS generators use the C (or CXX) preprocessor definitions for
the Windows Resource Compiler tool. This causes definitions parsed
out of `CMAKE_RC_FLAGS[_<CONFIG>]` variables to be dropped. Fix
the implementation to preserve both.
Issue: #16745
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 7447821..902fe03 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2346,6 +2346,11 @@ bool cmVisualStudio10TargetGenerator::ComputeRcOptions( std::string(this->Makefile->GetSafeDefinition(rcConfigFlagsVar)); rcOptions.Parse(flags.c_str()); + + // For historical reasons, add the C preprocessor defines to RC. + Options& clOptions = *(this->ClOptions[configName]); + rcOptions.AddDefines(clOptions.GetDefines()); + this->RcOptions[configName] = pOptions.release(); return true; } @@ -2358,12 +2363,9 @@ void cmVisualStudio10TargetGenerator::WriteRCOptions( } this->WriteString("<ResourceCompile>\n", 2); - // Preprocessor definitions and includes are shared with clOptions. - Options& clOptions = *(this->ClOptions[configName]); - clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", - "\n", "RC"); - Options& rcOptions = *(this->RcOptions[configName]); + rcOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", + "\n", "RC"); rcOptions.AppendFlag("AdditionalIncludeDirectories", includes); rcOptions.AppendFlag("AdditionalIncludeDirectories", "%(AdditionalIncludeDirectories)"); |