summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-04-16 15:04:27 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-04-16 15:05:04 (GMT)
commit854cc83a76a021301c49ae27cbd8924a2b5c97a5 (patch)
treecb4648e0c9536293763e709846c25cc2bd2b1466 /Source/cmMakefileTargetGenerator.cxx
parentb9b69774ee891e742bdeee6bf0afee96cbb970b3 (diff)
parenta4173ef1658078d4dde186489e136c805b370410 (diff)
downloadCMake-854cc83a76a021301c49ae27cbd8924a2b5c97a5.zip
CMake-854cc83a76a021301c49ae27cbd8924a2b5c97a5.tar.gz
CMake-854cc83a76a021301c49ae27cbd8924a2b5c97a5.tar.bz2
Merge topic 'makefile-target-special'
a4173ef165 Tests: Enable coverage of special chars in include dirs for Makefiles d74e651b78 Makefiles: Re-implement makefile target path escaping and quoting 031bfaa865 Makefiles: Factor out makefile target path escaping and quoting ca343dad07 Makefiles: Convert paths with '#' on command-lines to short path on Windows af7de05853 Makefiles: Do not use '\#' escape sequence with Windows-style make tools 1639ee70ef cmDepends: Update types to always use a Makefile generator 413d26030f cmGlobalNinjaGenerator: Remove outdated comment Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4605
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileTargetGenerator.cxx14
1 files changed, 10 insertions, 4 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 2d8f8d6..ee87044 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -341,12 +341,16 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
<< "\n";
}
+ bool const escapeOctothorpe = this->GlobalGenerator->CanEscapeOctothorpe();
+
for (std::string const& language : languages) {
std::string defines = this->GetDefines(language, this->GetConfigName());
std::string includes = this->GetIncludes(language, this->GetConfigName());
- // Escape comment characters so they do not terminate assignment.
- cmSystemTools::ReplaceString(defines, "#", "\\#");
- cmSystemTools::ReplaceString(includes, "#", "\\#");
+ if (escapeOctothorpe) {
+ // Escape comment characters so they do not terminate assignment.
+ cmSystemTools::ReplaceString(defines, "#", "\\#");
+ cmSystemTools::ReplaceString(includes, "#", "\\#");
+ }
*this->FlagFileStream << language << "_DEFINES = " << defines << "\n\n";
*this->FlagFileStream << language << "_INCLUDES = " << includes << "\n\n";
@@ -357,7 +361,9 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
for (const std::string& arch : architectures) {
std::string flags =
this->GetFlags(language, this->GetConfigName(), arch);
- cmSystemTools::ReplaceString(flags, "#", "\\#");
+ if (escapeOctothorpe) {
+ cmSystemTools::ReplaceString(flags, "#", "\\#");
+ }
*this->FlagFileStream << language << "_FLAGS" << arch << " = " << flags
<< "\n\n";
}