diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-05-16 12:59:04 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-06-02 09:56:36 (GMT) |
commit | 35496761a58956bd8c5ad65a3ed9ee78d09af56b (patch) | |
tree | f02c889f4da5c1da5d9a6eef5d9ea73fbc0f1a16 /Source/cmMakefileTargetGenerator.cxx | |
parent | f3ad863ae6f0487bbf80d95b0d3f622840187a6a (diff) | |
download | CMake-35496761a58956bd8c5ad65a3ed9ee78d09af56b.zip CMake-35496761a58956bd8c5ad65a3ed9ee78d09af56b.tar.gz CMake-35496761a58956bd8c5ad65a3ed9ee78d09af56b.tar.bz2 |
Add cmLocalGenerator::GetCompileOptions.
Currently it only adds the contents of the COMPILE_FLAGS target
property, but it can be extended to handle a new COMPILE_OPTIONS
generator expression enabled property.
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 4220ae1..d83d722 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -332,21 +332,25 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags() this->Makefile->GetSafeDefinition(compiler.c_str()) << "\n"; } + std::string targetFlags; for(std::set<cmStdString>::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 targetLangFlags; + this->LocalGenerator->GetCompileOptions(targetLangFlags, this->Target, + this->LocalGenerator->ConfigurationName.c_str()); + if (!targetFlags.empty() && targetFlags != targetLangFlags) + { + targetFlags += " " + targetLangFlags; + } } - // Add target-specific flags. - if(this->Target->GetProperty("COMPILE_FLAGS")) + if (!targetFlags.empty()) { - std::string flags; - this->LocalGenerator->AppendFlags - (flags, this->Target->GetProperty("COMPILE_FLAGS")); - *this->FlagFileStream << "# TARGET_FLAGS = " << flags << "\n\n"; + *this->FlagFileStream << "# TARGET_FLAGS = " << targetFlags << "\n\n"; } } @@ -532,8 +536,13 @@ cmMakefileTargetGenerator langFlags += "_FLAGS)"; this->LocalGenerator->AppendFlags(flags, langFlags.c_str()); - // Add target-specific flags. - if(this->Target->GetProperty("COMPILE_FLAGS")) + std::string configUpper = + cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName); + + std::string targetFlags; + this->LocalGenerator->GetCompileOptions(targetFlags, this->Target, + configUpper.c_str()); + if (!targetFlags.empty()) { std::string langIncludeExpr = "CMAKE_"; langIncludeExpr += lang; @@ -545,7 +554,7 @@ cmMakefileTargetGenerator cmsys::RegularExpression r(regex); std::vector<std::string> args; cmSystemTools::ParseWindowsCommandLine( - this->Target->GetProperty("COMPILE_FLAGS"), + targetFlags.c_str(), args); for(std::vector<std::string>::iterator i = args.begin(); i != args.end(); ++i) @@ -559,8 +568,7 @@ cmMakefileTargetGenerator } else { - this->LocalGenerator->AppendFlags - (flags, this->Target->GetProperty("COMPILE_FLAGS")); + this->LocalGenerator->AppendFlags(flags, targetFlags.c_str()); } } @@ -594,8 +602,6 @@ cmMakefileTargetGenerator << compile_defs << "\n" << "\n"; } - std::string configUpper = - cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName); std::string defPropName = "COMPILE_DEFINITIONS_"; defPropName += configUpper; if(const char* config_compile_defs = |