summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-08-18 15:21:45 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-08-18 15:21:45 (GMT)
commit3353657919f8cd05a206c81056fc9a9bdb29ac00 (patch)
tree61f74170aad4629249034fd50ece6002f4be32f5 /Source/cmMakefileTargetGenerator.cxx
parent258c5c2f27886ca60bda5a6a1f6411310f0bf1df (diff)
parentfbf7a9297571b7e26739009d7026fbe21c3ccbc7 (diff)
downloadCMake-3353657919f8cd05a206c81056fc9a9bdb29ac00.zip
CMake-3353657919f8cd05a206c81056fc9a9bdb29ac00.tar.gz
CMake-3353657919f8cd05a206c81056fc9a9bdb29ac00.tar.bz2
Merge topic 'makefile-assign-escape-octothorpe'
fbf7a929 Makefile: Handle '#' in COMPILE_OPTIONS (#15070)
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileTargetGenerator.cxx10
1 files changed, 7 insertions, 3 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 758c8e4..7849d12 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -361,9 +361,13 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags()
for(std::set<std::string>::const_iterator l = languages.begin();
l != languages.end(); ++l)
{
- *this->FlagFileStream << *l << "_FLAGS = " << this->GetFlags(*l) << "\n\n";
- *this->FlagFileStream << *l << "_DEFINES = " << this->GetDefines(*l) <<
- "\n\n";
+ std::string flags = this->GetFlags(*l);
+ std::string defines = this->GetDefines(*l);
+ // Escape comment characters so they do not terminate assignment.
+ cmSystemTools::ReplaceString(flags, "#", "\\#");
+ cmSystemTools::ReplaceString(defines, "#", "\\#");
+ *this->FlagFileStream << *l << "_FLAGS = " << flags << "\n\n";
+ *this->FlagFileStream << *l << "_DEFINES = " << defines << "\n\n";
}
}