diff options
author | Brad King <brad.king@kitware.com> | 2014-08-12 17:26:03 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-08-12 17:56:21 (GMT) |
commit | fbf7a9297571b7e26739009d7026fbe21c3ccbc7 (patch) | |
tree | bf5da358ee2d7a1dd387944c5982a608d7b2de67 /Source/cmMakefileTargetGenerator.cxx | |
parent | 1f8cfc3b5f4bd87216e48c6bf909b59f10b9065e (diff) | |
download | CMake-fbf7a9297571b7e26739009d7026fbe21c3ccbc7.zip CMake-fbf7a9297571b7e26739009d7026fbe21c3ccbc7.tar.gz CMake-fbf7a9297571b7e26739009d7026fbe21c3ccbc7.tar.bz2 |
Makefile: Handle '#' in COMPILE_OPTIONS (#15070)
Teach the Makefile generators to escape '#' characters on the right hand
side of variable assignments in flags.make. This is needed for flags
like '-Wno-error=#warnings'. Otherwise the make tool treats them as
comments and leaves them out of the _FLAGS variable value.
Add a case to the CompileOptions test covering '#' in a COMPILE_OPTIONS
value, at least on compilers where it is known to be supported.
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 10 |
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"; } } |