Update generator to use new cmGeneratorTarget api.

This commit is contained in:
Robert Maynard 2013-02-11 17:23:02 -05:00 committed by Brad King
parent 674bd6e778
commit f616ff2c25
1 changed files with 14 additions and 11 deletions

View File

@ -11,14 +11,16 @@
See the License for more information. See the License for more information.
============================================================================*/ ============================================================================*/
#include "cmExtraSublimeTextGenerator.h" #include "cmExtraSublimeTextGenerator.h"
#include "cmake.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalUnixMakefileGenerator3.h" #include "cmGlobalUnixMakefileGenerator3.h"
#include "cmLocalGenerator.h"
#include "cmLocalUnixMakefileGenerator3.h" #include "cmLocalUnixMakefileGenerator3.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmake.h"
#include "cmSourceFile.h" #include "cmSourceFile.h"
#include "cmGeneratedFileStream.h"
#include "cmTarget.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmXMLSafe.h" #include "cmXMLSafe.h"
#include <cmsys/SystemTools.hxx> #include <cmsys/SystemTools.hxx>
@ -253,10 +255,11 @@ void cmExtraSublimeTextGenerator::
cmTarget* target, cmTarget* target,
const char* make, const char* make,
const cmMakefile* makefile, const cmMakefile* makefile,
const char* compiler, const char*, //compiler
MapSourceFileFlags& sourceFileFlags, MapSourceFileFlags& sourceFileFlags,
bool firstTarget) bool firstTarget)
{ {
if (target != 0) if (target != 0)
{ {
cmGeneratorTarget *gtgt = this->GlobalGenerator cmGeneratorTarget *gtgt = this->GlobalGenerator
@ -426,7 +429,7 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source,
lg->AppendFlags(flags, makefile->GetDefineFlags()); lg->AppendFlags(flags, makefile->GetDefineFlags());
// Add target-specific flags. // Add target-specific flags.
if(gtgt->GetProperty("COMPILE_FLAGS")) if(target->GetProperty("COMPILE_FLAGS"))
{ {
std::string langIncludeExpr = "CMAKE_"; std::string langIncludeExpr = "CMAKE_";
langIncludeExpr += language; langIncludeExpr += language;
@ -437,7 +440,7 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source,
cmsys::RegularExpression r(regex); cmsys::RegularExpression r(regex);
std::vector<std::string> args; std::vector<std::string> args;
cmSystemTools:: cmSystemTools::
ParseWindowsCommandLine(gtgt->GetProperty("COMPILE_FLAGS"), args); ParseWindowsCommandLine(target->GetProperty("COMPILE_FLAGS"), args);
for(std::vector<std::string>::iterator i = args.begin(); for(std::vector<std::string>::iterator i = args.begin();
i != args.end(); ++i) i != args.end(); ++i)
{ {
@ -449,12 +452,12 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source,
} }
else else
{ {
lg->AppendFlags(flags, gtgt->GetProperty("COMPILE_FLAGS")); lg->AppendFlags(flags, target->GetProperty("COMPILE_FLAGS"));
} }
} }
// Add source file specific flags. // Add source file specific flags.
lg->AppendFlags(flags, source->GetProperty("COMPILE_FLAGS")); lg->AppendFlags(flags, target->GetProperty("COMPILE_FLAGS"));
// TODO: Handle Apple frameworks. // TODO: Handle Apple frameworks.
@ -466,7 +469,7 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source,
std::string std::string
cmExtraSublimeTextGenerator:: cmExtraSublimeTextGenerator::
ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target, ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target,
cmGeneratorTarget* gtgt) cmGeneratorTarget*)
{ {
std::set<std::string> defines; std::set<std::string> defines;
@ -485,12 +488,12 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target,
} }
// Add preprocessor definitions for this target and configuration. // Add preprocessor definitions for this target and configuration.
lg->AppendDefines(defines, gtgt->GetCompileDefinitions()); lg->AppendDefines(defines, target->GetCompileDefinitions());
lg->AppendDefines(defines, source->GetProperty("COMPILE_DEFINITIONS")); lg->AppendDefines(defines, source->GetProperty("COMPILE_DEFINITIONS"));
{ {
std::string defPropName = "COMPILE_DEFINITIONS_"; std::string defPropName = "COMPILE_DEFINITIONS_";
defPropName += cmSystemTools::UpperCase(config); defPropName += cmSystemTools::UpperCase(config);
lg->AppendDefines(defines, gtgt->GetCompileDefinitions(config)); lg->AppendDefines(defines, target->GetCompileDefinitions(config));
lg->AppendDefines(defines, source->GetProperty(defPropName.c_str())); lg->AppendDefines(defines, source->GetProperty(defPropName.c_str()));
} }