Refactor target COMPILE_OPTIONS and COMPILE_FLAGS handling

Replace the cmLocalGenerator GetCompileOptions method with an
AddCompileOptions method since all call sites of the former simply
append the result to a flags string anyway.

Add a "lang" argument to AddCompileOptions and move the
CMAKE_<LANG>_FLAGS_REGEX filter into it.  Move the call sites in each
generator to a location that has both the language and configuration
available.  In the Makefile generator this also moves the flags from
build.make to flags.make where they belong.
This commit is contained in:
Brad King
2013-06-27 12:04:02 -04:00
parent b6385cabec
commit d221eac812
9 changed files with 67 additions and 171 deletions
+3 -9
View File
@@ -711,6 +711,9 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
{
flags += " /TP ";
}
// Add the target-specific flags.
this->AddCompileOptions(flags, &target, linkLanguage, configName);
}
if(this->FortranProject)
@@ -723,15 +726,6 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
}
}
std::string targetFlags;
this->GetCompileOptions(targetFlags, &target, configName);
// Add the target-specific flags.
if(!targetFlags.empty())
{
flags += " ";
flags += targetFlags;
}
// Get preprocessor definitions for this directory.
std::string defineFlags = this->Makefile->GetDefineFlags();
Options::Tool t = Options::Compiler;