Merge topic 'use-generator-target'

57f03e59 Port some of the cmExportFileGenerator API to cmGeneratorTarget.
57ab0f70 Port cmExportBuildFileGenerator to cmGeneratorTarget.
570938cb cmExportTryCompileFileGenerator: Create cmGeneratorTargets.
ec38e4c8 Move GetFullPath to cmGeneratorTarget
dfb025bf Move GetLocationForBuild to cmGeneratorTarget.
9f2dca80 Move GetLocation to cmGeneratorTarget.
c7a8e74b Always access target location from a cmGeneratorTarget instance.
5b60eaf6 cmTarget: Restore the ImportedGetLocation method.
50b17a61 cmIncludeCommand: Populate the cmGeneratorTargets in deprecated path.
ba266858 cmTarget: Create cmGeneratorTargets before reading deprecated LOCATION.
5ab3a946 cmTarget: Inline GetLocation into deprecated callers.
496f4cd0 cmGlobalGenerator: Create cmGeneratorTargets before QtAutomoc.
de80993a cmGlobalGenerator: Create cmGeneratorTargets earlier.
611220f7 cmTarget: Use reliable test for CMP0024 and CMP0026 OLD.
bbad6ba5 cmLocalGenerator: Remove unused AddCustomCommandToCreateObject method.
e4dc83ad cmLocalGenerator: Remove unused AddBuildTargetRule method.
...
This commit is contained in:
Brad King 2015-07-28 10:08:50 -04:00 committed by CMake Topic Stage
commit 98d6e9ec2d
42 changed files with 478 additions and 560 deletions

View File

@ -1,13 +1,14 @@
#include "cmCPackPropertiesGenerator.h"
#include "cmOutputConverter.h"
#include "cmLocalGenerator.h"
cmCPackPropertiesGenerator::cmCPackPropertiesGenerator(
cmMakefile* mf,
cmLocalGenerator* lg,
cmInstalledFile const& installedFile,
std::vector<std::string> const& configurations):
cmScriptGenerator("CPACK_BUILD_CONFIG", configurations),
Makefile(mf),
LG(lg),
InstalledFile(installedFile)
{
this->ActionsPerConfig = true;
@ -17,7 +18,8 @@ void cmCPackPropertiesGenerator::GenerateScriptForConfig(std::ostream& os,
const std::string& config, Indent const& indent)
{
std::string const& expandedFileName =
this->InstalledFile.GetNameExpression().Evaluate(this->Makefile, config);
this->InstalledFile.GetNameExpression().Evaluate(this->LG->GetMakefile(),
config);
cmInstalledFile::PropertyMapType const& properties =
this->InstalledFile.GetProperties();
@ -36,7 +38,7 @@ void cmCPackPropertiesGenerator::GenerateScriptForConfig(std::ostream& os,
j = property.ValueExpressions.begin();
j != property.ValueExpressions.end(); ++j)
{
std::string value = (*j)->Evaluate(this->Makefile, config);
std::string value = (*j)->Evaluate(LG->GetMakefile(), config);
os << " " << cmOutputConverter::EscapeForCMake(value);
}

View File

@ -15,6 +15,8 @@
#include "cmScriptGenerator.h"
#include "cmInstalledFile.h"
class cmLocalGenerator;
/** \class cmCPackPropertiesGenerator
* \brief Support class for generating CPackProperties.cmake.
*
@ -23,7 +25,7 @@ class cmCPackPropertiesGenerator: public cmScriptGenerator
{
public:
cmCPackPropertiesGenerator(
cmMakefile* mf,
cmLocalGenerator* lg,
cmInstalledFile const& installedFile,
std::vector<std::string> const& configurations);
@ -31,7 +33,7 @@ protected:
virtual void GenerateScriptForConfig(std::ostream& os,
const std::string& config, Indent const& indent);
cmMakefile* Makefile;
cmLocalGenerator* LG;
cmInstalledFile const& InstalledFile;
};

View File

@ -535,10 +535,13 @@ bool cmComputeLinkInformation::Compute()
i != wrongItems.end(); ++i)
{
cmTarget const* tgt = *i;
cmGeneratorTarget *gtgt = tgt->GetMakefile()
->GetGlobalGenerator()
->GetGeneratorTarget(tgt);
bool implib =
(this->UseImportLibrary &&
(tgt->GetType() == cmTarget::SHARED_LIBRARY));
std::string lib = tgt->GetFullPath(this->Config , implib, true);
std::string lib = gtgt->GetFullPath(this->Config , implib, true);
this->OldLinkDirItems.push_back(lib);
}
}
@ -637,6 +640,9 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
if(tgt && tgt->IsLinkable())
{
cmGeneratorTarget *gtgt = tgt->GetMakefile()
->GetGlobalGenerator()
->GetGeneratorTarget(tgt);
// This is a CMake target. Ask the target for its real name.
if(impexe && this->LoaderFlag)
{
@ -645,7 +651,8 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
// platform. Add it now.
std::string linkItem;
linkItem = this->LoaderFlag;
std::string exe = tgt->GetFullPath(config, this->UseImportLibrary,
std::string exe = gtgt->GetFullPath(config, this->UseImportLibrary,
true);
linkItem += exe;
this->Items.push_back(Item(linkItem, true, tgt));
@ -666,7 +673,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
(impexe || tgt->GetType() == cmTarget::SHARED_LIBRARY));
// Pass the full path to the target file.
std::string lib = tgt->GetFullPath(config, implib, true);
std::string lib = gtgt->GetFullPath(config, implib, true);
if(!this->LinkDependsNoShared ||
tgt->GetType() != cmTarget::SHARED_LIBRARY)
{
@ -755,7 +762,10 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
std::string lib;
if(tgt)
{
lib = tgt->GetFullPath(this->Config, this->UseImportLibrary);
cmGeneratorTarget *gtgt = tgt->GetMakefile()
->GetGlobalGenerator()
->GetGeneratorTarget(tgt);
lib = gtgt->GetFullPath(this->Config, this->UseImportLibrary);
this->AddLibraryRuntimeInfo(lib, tgt);
}
else

View File

@ -379,7 +379,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
if (!targets.empty())
{
std::string fname = "/" + std::string(targetName) + "Targets.cmake";
cmExportTryCompileFileGenerator tcfg;
cmExportTryCompileFileGenerator tcfg(gg);
tcfg.SetExportFile((this->BinaryDirectory + fname).c_str());
tcfg.SetExports(targets);
tcfg.SetConfig(this->Makefile->GetSafeDefinition(

View File

@ -12,14 +12,15 @@
#include "cmCustomCommandGenerator.h"
#include "cmMakefile.h"
#include "cmLocalGenerator.h"
#include "cmCustomCommand.h"
#include "cmOutputConverter.h"
#include "cmGeneratorExpression.h"
//----------------------------------------------------------------------------
cmCustomCommandGenerator::cmCustomCommandGenerator(
cmCustomCommand const& cc, const std::string& config, cmMakefile* mf):
CC(cc), Config(config), Makefile(mf),
cmCustomCommand const& cc, const std::string& config, cmLocalGenerator* lg):
CC(cc), Config(config), LG(lg),
OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()),
GE(new cmGeneratorExpression(cc.GetBacktrace())), DependsDone(false)
{
@ -41,13 +42,16 @@ unsigned int cmCustomCommandGenerator::GetNumberOfCommands() const
std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
{
std::string const& argv0 = this->CC.GetCommandLines()[c][0];
cmTarget* target = this->Makefile->FindTargetToUse(argv0);
cmGeneratorTarget* target =
this->LG->GetMakefile()->FindGeneratorTargetToUse(argv0);
if(target && target->GetType() == cmTarget::EXECUTABLE &&
(target->IsImported() || !this->Makefile->IsOn("CMAKE_CROSSCOMPILING")))
(target->Target->IsImported()
|| !this->LG->GetMakefile()->IsOn("CMAKE_CROSSCOMPILING")))
{
return target->GetLocation(this->Config);
}
return this->GE->Parse(argv0)->Evaluate(this->Makefile, this->Config);
return this->GE->Parse(argv0)->Evaluate(this->LG->GetMakefile(),
this->Config);
}
//----------------------------------------------------------------------------
@ -87,8 +91,9 @@ cmCustomCommandGenerator
cmCustomCommandLine const& commandLine = this->CC.GetCommandLines()[c];
for(unsigned int j=1;j < commandLine.size(); ++j)
{
std::string arg = this->GE->Parse(commandLine[j])->Evaluate(this->Makefile,
this->Config);
std::string arg =
this->GE->Parse(commandLine[j])->Evaluate(this->LG->GetMakefile(),
this->Config);
cmd += " ";
if(this->OldStyle)
{
@ -96,7 +101,7 @@ cmCustomCommandGenerator
}
else
{
cmOutputConverter converter(this->Makefile->GetStateSnapshot());
cmOutputConverter converter(this->LG->GetMakefile()->GetStateSnapshot());
cmd += converter.EscapeForShell(arg, this->MakeVars);
}
}
@ -141,7 +146,7 @@ std::vector<std::string> const& cmCustomCommandGenerator::GetDepends() const
= this->GE->Parse(*i);
std::vector<std::string> result;
cmSystemTools::ExpandListArgument(
cge->Evaluate(this->Makefile, this->Config), result);
cge->Evaluate(this->LG->GetMakefile(), this->Config), result);
for (std::vector<std::string>::iterator it = result.begin();
it != result.end(); ++it)
{

View File

@ -15,14 +15,14 @@
#include "cmStandardIncludes.h"
class cmCustomCommand;
class cmMakefile;
class cmLocalGenerator;
class cmGeneratorExpression;
class cmCustomCommandGenerator
{
cmCustomCommand const& CC;
std::string Config;
cmMakefile* Makefile;
cmLocalGenerator* LG;
bool OldStyle;
bool MakeVars;
cmGeneratorExpression* GE;
@ -31,7 +31,7 @@ class cmCustomCommandGenerator
public:
cmCustomCommandGenerator(cmCustomCommand const& cc,
const std::string& config,
cmMakefile* mf);
cmLocalGenerator* lg);
~cmCustomCommandGenerator();
cmCustomCommand const& GetCC() const { return this->CC; }
unsigned int GetNumberOfCommands() const;

View File

@ -36,10 +36,11 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
tei = targets.begin();
tei != targets.end(); ++tei)
{
cmTarget *te = this->Makefile->FindTargetToUse(*tei);
expectedTargets += sep + this->Namespace + te->GetExportName();
cmGeneratorTarget *te = this->Makefile
->FindGeneratorTargetToUse(*tei);
expectedTargets += sep + this->Namespace + te->Target->GetExportName();
sep = " ";
if(this->ExportedTargets.insert(te).second)
if(this->ExportedTargets.insert(te->Target).second)
{
this->Exports.push_back(te);
}
@ -63,11 +64,11 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
std::vector<std::string> missingTargets;
// Create all the imported targets.
for(std::vector<cmTarget*>::const_iterator
for(std::vector<cmGeneratorTarget*>::const_iterator
tei = this->Exports.begin();
tei != this->Exports.end(); ++tei)
{
cmTarget* te = *tei;
cmTarget* te = (*tei)->Target;
this->GenerateImportTargetCode(os, te);
te->AppendBuildInterfaceIncludes();
@ -129,12 +130,12 @@ cmExportBuildFileGenerator
std::string const& suffix,
std::vector<std::string> &missingTargets)
{
for(std::vector<cmTarget*>::const_iterator
for(std::vector<cmGeneratorTarget*>::const_iterator
tei = this->Exports.begin();
tei != this->Exports.end(); ++tei)
{
// Collect import properties for this target.
cmTarget* target = *tei;
cmGeneratorTarget* target = *tei;
ImportPropertyMap properties;
if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
@ -147,10 +148,12 @@ cmExportBuildFileGenerator
if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
this->SetImportDetailProperties(config, suffix,
target, properties, missingTargets);
target,
properties, missingTargets);
this->SetImportLinkInterface(config, suffix,
cmGeneratorExpression::BuildInterface,
target, properties, missingTargets);
cmGeneratorExpression::BuildInterface,
target,
properties, missingTargets);
}
// TOOD: PUBLIC_HEADER_LOCATION
@ -160,7 +163,8 @@ cmExportBuildFileGenerator
// properties);
// Generate code in the export file.
this->GenerateImportPropertyCode(os, config, target, properties);
this->GenerateImportPropertyCode(os, config, target->Target,
properties);
}
}
}
@ -176,17 +180,18 @@ void
cmExportBuildFileGenerator
::SetImportLocationProperty(const std::string& config,
std::string const& suffix,
cmTarget* target, ImportPropertyMap& properties)
cmGeneratorTarget* target,
ImportPropertyMap& properties)
{
// Get the makefile in which to lookup target information.
cmMakefile* mf = target->GetMakefile();
cmMakefile* mf = target->Makefile;
// Add the main target file.
{
std::string prop = "IMPORTED_LOCATION";
prop += suffix;
std::string value;
if(target->IsAppBundleOnApple())
if(target->Target->IsAppBundleOnApple())
{
value = target->GetFullPath(config, false);
}
@ -204,13 +209,13 @@ cmExportBuildFileGenerator
// Add the import library for windows DLLs.
if(dll_platform &&
(target->GetType() == cmTarget::SHARED_LIBRARY ||
target->IsExecutableWithExports()) &&
target->Target->IsExecutableWithExports()) &&
mf->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"))
{
std::string prop = "IMPORTED_IMPLIB";
prop += suffix;
std::string value = target->GetFullPath(config, true);
target->GetImplibGNUtoMS(value, value,
target->Target->GetImplibGNUtoMS(value, value,
"${CMAKE_IMPORT_LIBRARY_SUFFIX}");
properties[prop] = value;
}

View File

@ -68,7 +68,7 @@ protected:
/** Fill in properties indicating built file locations. */
void SetImportLocationProperty(const std::string& config,
std::string const& suffix,
cmTarget* target,
cmGeneratorTarget* target,
ImportPropertyMap& properties);
std::string InstallNameDir(cmTarget* target, const std::string& config);
@ -78,7 +78,7 @@ protected:
std::vector<std::string> Targets;
cmExportSet *ExportSet;
std::vector<cmTarget*> Exports;
std::vector<cmGeneratorTarget*> Exports;
cmMakefile* Makefile;
cmListFileBacktrace Backtrace;
};

View File

@ -791,12 +791,13 @@ void
cmExportFileGenerator
::SetImportLinkInterface(const std::string& config, std::string const& suffix,
cmGeneratorExpression::PreprocessContext preprocessRule,
cmTarget* target, ImportPropertyMap& properties,
cmGeneratorTarget* target, ImportPropertyMap& properties,
std::vector<std::string>& missingTargets)
{
// Add the transitive link dependencies for this configuration.
cmTarget::LinkInterface const* iface = target->GetLinkInterface(config,
target);
cmTarget::LinkInterface const* iface = target->Target->GetLinkInterface(
config,
target->Target);
if (!iface)
{
return;
@ -829,12 +830,14 @@ cmExportFileGenerator
}
const bool newCMP0022Behavior =
target->GetPolicyStatusCMP0022() != cmPolicies::WARN
&& target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
target->Target
->GetPolicyStatusCMP0022() != cmPolicies::WARN
&& target->Target
->GetPolicyStatusCMP0022() != cmPolicies::OLD;
if(newCMP0022Behavior && !this->ExportOld)
{
cmMakefile *mf = target->GetMakefile();
cmMakefile *mf = target->Target->GetMakefile();
std::ostringstream e;
e << "Target \"" << target->GetName() << "\" has policy CMP0022 enabled, "
"but also has old-style LINK_INTERFACE_LIBRARIES properties "
@ -854,7 +857,7 @@ cmExportFileGenerator
preprocessRule);
if (!prepro.empty())
{
this->ResolveTargetsInGeneratorExpressions(prepro, target,
this->ResolveTargetsInGeneratorExpressions(prepro, target->Target,
missingTargets,
ReplaceFreeTargets);
properties["IMPORTED_LINK_INTERFACE_LIBRARIES" + suffix] = prepro;
@ -866,12 +869,13 @@ void
cmExportFileGenerator
::SetImportDetailProperties(const std::string& config,
std::string const& suffix,
cmTarget* target, ImportPropertyMap& properties,
cmGeneratorTarget* target,
ImportPropertyMap& properties,
std::vector<std::string>& missingTargets
)
{
// Get the makefile in which to lookup target information.
cmMakefile* mf = target->GetMakefile();
cmMakefile* mf = target->Makefile;
// Add the soname for unix shared libraries.
if(target->GetType() == cmTarget::SHARED_LIBRARY ||
@ -884,14 +888,14 @@ cmExportFileGenerator
{
std::string prop;
std::string value;
if(target->HasSOName(config))
if(target->Target->HasSOName(config))
{
if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
{
value = this->InstallNameDir(target, config);
value = this->InstallNameDir(target->Target, config);
}
prop = "IMPORTED_SONAME";
value += target->GetSOName(config);
value += target->Target->GetSOName(config);
}
else
{
@ -904,8 +908,9 @@ cmExportFileGenerator
}
// Add the transitive link dependencies for this configuration.
if(cmTarget::LinkInterface const* iface = target->GetLinkInterface(config,
target))
if(cmTarget::LinkInterface const* iface =
target->Target
->GetLinkInterface(config, target->Target))
{
this->SetImportLinkProperty(suffix, target,
"IMPORTED_LINK_INTERFACE_LANGUAGES",
@ -931,7 +936,7 @@ template <typename T>
void
cmExportFileGenerator
::SetImportLinkProperty(std::string const& suffix,
cmTarget* target,
cmGeneratorTarget* target,
const std::string& propName,
std::vector<T> const& entries,
ImportPropertyMap& properties,
@ -955,7 +960,7 @@ cmExportFileGenerator
sep = ";";
std::string temp = *li;
this->AddTargetNamespace(temp, target, missingTargets);
this->AddTargetNamespace(temp, target->Target, missingTargets);
link_entries += temp;
}

View File

@ -92,13 +92,15 @@ protected:
// Collect properties with detailed information about targets beyond
// their location on disk.
void SetImportDetailProperties(const std::string& config,
std::string const& suffix, cmTarget* target,
std::string const& suffix,
cmGeneratorTarget* target,
ImportPropertyMap& properties,
std::vector<std::string>& missingTargets);
template <typename T>
void SetImportLinkProperty(std::string const& suffix,
cmTarget* target, const std::string& propName,
cmGeneratorTarget* target,
const std::string& propName,
std::vector<T> const& entries,
ImportPropertyMap& properties,
std::vector<std::string>& missingTargets);
@ -148,7 +150,7 @@ protected:
void SetImportLinkInterface(const std::string& config,
std::string const& suffix,
cmGeneratorExpression::PreprocessContext preprocessRule,
cmTarget* target, ImportPropertyMap& properties,
cmGeneratorTarget* target, ImportPropertyMap& properties,
std::vector<std::string>& missingTargets);
enum FreeTargetsReplace {

View File

@ -358,12 +358,14 @@ cmExportInstallFileGenerator
if(!properties.empty())
{
// Get the rest of the target details.
cmGeneratorTarget *gtgt = te->Target->GetMakefile()->GetLocalGenerator()
->GetGlobalGenerator()->GetGeneratorTarget(te->Target);
this->SetImportDetailProperties(config, suffix,
te->Target, properties, missingTargets);
gtgt, properties, missingTargets);
this->SetImportLinkInterface(config, suffix,
cmGeneratorExpression::InstallInterface,
te->Target, properties, missingTargets);
gtgt, properties, missingTargets);
// TOOD: PUBLIC_HEADER_LOCATION
// This should wait until the build feature propagation stuff

View File

@ -13,9 +13,16 @@
#include "cmExportTryCompileFileGenerator.h"
#include "cmGeneratedFileStream.h"
#include "cmGlobalGenerator.h"
#include "cmGeneratorExpressionDAGChecker.h"
//----------------------------------------------------------------------------
cmExportTryCompileFileGenerator::cmExportTryCompileFileGenerator(
cmGlobalGenerator* gg)
{
gg->CreateGenerationObjects(cmGlobalGenerator::ImportedOnly);
}
bool cmExportTryCompileFileGenerator::GenerateMainFile(std::ostream& os)
{
std::set<cmTarget const*> emitted;

View File

@ -20,6 +20,8 @@ class cmInstallTargetGenerator;
class cmExportTryCompileFileGenerator: public cmExportFileGenerator
{
public:
cmExportTryCompileFileGenerator(cmGlobalGenerator* gg);
/** Set the list of targets to export. */
void SetExports(const std::vector<cmTarget const*> &exports)
{ this->Exports = exports; }

View File

@ -591,7 +591,9 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
}
else
{
location = target->GetLocation(buildType);
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(target);
location = gt->GetLocation(buildType);
}
fout<<" <Option output=\"" << location

View File

@ -1556,7 +1556,7 @@ class ArtifactDirTag;
template<typename ArtifactT>
struct TargetFilesystemArtifactResultCreator
{
static std::string Create(cmTarget* target,
static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext *context,
const GeneratorExpressionContent *content);
};
@ -1565,12 +1565,12 @@ struct TargetFilesystemArtifactResultCreator
template<>
struct TargetFilesystemArtifactResultCreator<ArtifactSonameTag>
{
static std::string Create(cmTarget* target,
static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext *context,
const GeneratorExpressionContent *content)
{
// The target soname file (.so.1).
if(target->IsDLLPlatform())
if(target->Target->IsDLLPlatform())
{
::reportError(context, content->GetOriginalExpression(),
"TARGET_SONAME_FILE is not allowed "
@ -1584,9 +1584,9 @@ struct TargetFilesystemArtifactResultCreator<ArtifactSonameTag>
"SHARED libraries.");
return std::string();
}
std::string result = target->GetDirectory(context->Config);
std::string result = target->Target->GetDirectory(context->Config);
result += "/";
result += target->GetSOName(context->Config);
result += target->Target->GetSOName(context->Config);
return result;
}
};
@ -1595,11 +1595,11 @@ struct TargetFilesystemArtifactResultCreator<ArtifactSonameTag>
template<>
struct TargetFilesystemArtifactResultCreator<ArtifactPdbTag>
{
static std::string Create(cmTarget* target,
static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext *context,
const GeneratorExpressionContent *content)
{
std::string language = target->GetLinkerLanguage(context->Config);
std::string language = target->Target->GetLinkerLanguage(context->Config);
std::string pdbSupportVar = "CMAKE_" + language + "_LINKER_SUPPORTS_PDB";
@ -1610,7 +1610,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactPdbTag>
return std::string();
}
cmTarget::TargetType targetType = target->GetType();
cmTarget::TargetType targetType = target->Target->GetType();
if(targetType != cmTarget::SHARED_LIBRARY &&
targetType != cmTarget::MODULE_LIBRARY &&
@ -1622,9 +1622,9 @@ struct TargetFilesystemArtifactResultCreator<ArtifactPdbTag>
return std::string();
}
std::string result = target->GetPDBDirectory(context->Config);
std::string result = target->Target->GetPDBDirectory(context->Config);
result += "/";
result += target->GetPDBName(context->Config);
result += target->Target->GetPDBName(context->Config);
return result;
}
};
@ -1633,12 +1633,12 @@ struct TargetFilesystemArtifactResultCreator<ArtifactPdbTag>
template<>
struct TargetFilesystemArtifactResultCreator<ArtifactLinkerTag>
{
static std::string Create(cmTarget* target,
static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext *context,
const GeneratorExpressionContent *content)
{
// The file used to link to the target (.so, .lib, .a).
if(!target->IsLinkable())
if(!target->Target->IsLinkable())
{
::reportError(context, content->GetOriginalExpression(),
"TARGET_LINKER_FILE is allowed only for libraries and "
@ -1646,7 +1646,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactLinkerTag>
return std::string();
}
return target->GetFullPath(context->Config,
target->HasImportLibrary());
target->Target->HasImportLibrary());
}
};
@ -1654,7 +1654,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactLinkerTag>
template<>
struct TargetFilesystemArtifactResultCreator<ArtifactNameTag>
{
static std::string Create(cmTarget* target,
static std::string Create(cmGeneratorTarget* target,
cmGeneratorExpressionContext *context,
const GeneratorExpressionContent *)
{
@ -1716,7 +1716,8 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
"Expression syntax not recognized.");
return std::string();
}
cmTarget* target = context->Makefile->FindTargetToUse(name);
cmGeneratorTarget* target =
context->Makefile->FindGeneratorTargetToUse(name);
if(!target)
{
::reportError(context, content->GetOriginalExpression(),
@ -1739,8 +1740,8 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
"be used while evaluating link libraries");
return std::string();
}
context->DependTargets.insert(target);
context->AllTargets.insert(target);
context->DependTargets.insert(target->Target);
context->AllTargets.insert(target->Target);
std::string result =
TargetFilesystemArtifactResultCreator<ArtifactT>::Create(

View File

@ -519,6 +519,61 @@ void cmGeneratorTarget
srcs = data.XamlSources;
}
//----------------------------------------------------------------------------
const char* cmGeneratorTarget::GetLocation(const std::string& config) const
{
static std::string location;
if (this->Target->IsImported())
{
location = this->Target->ImportedGetFullPath(config, false);
}
else
{
location = this->GetFullPath(config, false);
}
return location.c_str();
}
bool cmGeneratorTarget::IsImported() const
{
return this->Target->IsImported();
}
//----------------------------------------------------------------------------
const char* cmGeneratorTarget::GetLocationForBuild() const
{
static std::string location;
if(this->IsImported())
{
location = this->Target->ImportedGetFullPath("", false);
return location.c_str();
}
// Now handle the deprecated build-time configuration location.
location = this->Target->GetDirectory();
const char* cfgid = this->Makefile->GetDefinition("CMAKE_CFG_INTDIR");
if(cfgid && strcmp(cfgid, ".") != 0)
{
location += "/";
location += cfgid;
}
if(this->Target->IsAppBundleOnApple())
{
std::string macdir = this->Target->BuildMacContentDirectory("", "",
false);
if(!macdir.empty())
{
location += "/";
location += macdir;
}
}
location += "/";
location += this->Target->GetFullName("", false);
return location.c_str();
}
//----------------------------------------------------------------------------
bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
const std::string& config) const
@ -834,7 +889,8 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep)
}
// Check for a target with this name.
if(cmTarget* t = this->Makefile->FindTargetToUse(util))
if(cmGeneratorTarget* t
= this->Makefile->FindGeneratorTargetToUse(util))
{
// If we find the target and the dep was given as a full path,
// then make sure it was not a full path to something else, and
@ -938,7 +994,8 @@ void cmTargetTraceDependencies::FollowCommandDepends(cmCustomCommand const& cc,
const std::string& config,
std::set<std::string>& emitted)
{
cmCustomCommandGenerator ccg(cc, config, this->Makefile);
cmCustomCommandGenerator ccg(cc, config,
this->GeneratorTarget->LocalGenerator);
const std::vector<std::string>& depends = ccg.GetDepends();
@ -1125,6 +1182,86 @@ void cmGeneratorTarget::GenerateTargetManifest(
}
}
//----------------------------------------------------------------------------
std::string cmGeneratorTarget::GetFullPath(const std::string& config,
bool implib, bool realname) const
{
if(this->Target->IsImported())
{
return this->Target->ImportedGetFullPath(config, implib);
}
else
{
return this->NormalGetFullPath(config, implib, realname);
}
}
std::string cmGeneratorTarget::NormalGetFullPath(const std::string& config,
bool implib,
bool realname) const
{
std::string fpath = this->Target->GetDirectory(config, implib);
fpath += "/";
if(this->Target->IsAppBundleOnApple())
{
fpath = this->Target->BuildMacContentDirectory(fpath, config, false);
fpath += "/";
}
// Add the full name of the target.
if(implib)
{
fpath += this->Target->GetFullName(config, true);
}
else if(realname)
{
fpath += this->NormalGetRealName(config);
}
else
{
fpath += this->Target->GetFullName(config, false);
}
return fpath;
}
//----------------------------------------------------------------------------
std::string
cmGeneratorTarget::NormalGetRealName(const std::string& config) const
{
// This should not be called for imported targets.
// TODO: Split cmTarget into a class hierarchy to get compile-time
// enforcement of the limited imported target API.
if(this->Target->IsImported())
{
std::string msg = "NormalGetRealName called on imported target: ";
msg += this->GetName();
this->Makefile->IssueMessage(cmake::INTERNAL_ERROR, msg);
}
if(this->GetType() == cmTarget::EXECUTABLE)
{
// Compute the real name that will be built.
std::string name;
std::string realName;
std::string impName;
std::string pdbName;
this->Target->GetExecutableNames(name, realName, impName, pdbName, config);
return realName;
}
else
{
// Compute the real name that will be built.
std::string name;
std::string soName;
std::string realName;
std::string impName;
std::string pdbName;
this->Target->GetLibraryNames(name, soName, realName,
impName, pdbName, config);
return realName;
}
}
bool cmStrictTargetComparison::operator()(cmTarget const* t1,
cmTarget const* t2) const
{

View File

@ -28,6 +28,14 @@ public:
cmLocalGenerator* GetLocalGenerator() const;
bool IsImported() const;
const char *GetLocation(const std::string& config) const;
/** Get the location of the target in the build tree with a placeholder
referencing the configuration in the native build system. This
location is suitable for use as the LOCATION target property. */
const char* GetLocationForBuild() const;
int GetType() const;
std::string GetName() const;
const char *GetProperty(const std::string& prop) const;
@ -74,6 +82,14 @@ public:
bool GetFeatureAsBool(const std::string& feature,
const std::string& config) const;
/** Get the full path to the target according to the settings in its
makefile and the configuration type. */
std::string GetFullPath(const std::string& config="", bool implib = false,
bool realname = false) const;
std::string NormalGetFullPath(const std::string& config, bool implib,
bool realname) const;
std::string NormalGetRealName(const std::string& config) const;
cmTarget* Target;
cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator;

View File

@ -1149,6 +1149,32 @@ void cmGlobalGenerator::Configure()
}
this->CMakeInstance->UpdateProgress(msg.str().c_str(), -1);
}
unsigned int i;
// Put a copy of each global target in every directory.
cmTargets globalTargets;
this->CreateDefaultGlobalTargets(&globalTargets);
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
cmMakefile* mf = this->LocalGenerators[i]->GetMakefile();
cmTargets* targets = &(mf->GetTargets());
cmTargets::iterator tit;
for ( tit = globalTargets.begin(); tit != globalTargets.end(); ++ tit )
{
(*targets)[tit->first] = tit->second;
(*targets)[tit->first].SetMakefile(mf);
}
}
}
void cmGlobalGenerator::CreateGenerationObjects(TargetTypes targetTypes)
{
cmDeleteAll(this->GeneratorTargets);
this->GeneratorTargets.clear();
this->CreateGeneratorTargets(targetTypes);
}
cmExportBuildFileGenerator*
@ -1208,6 +1234,8 @@ void cmGlobalGenerator::Generate()
this->FinalizeTargetCompileInfo();
this->CreateGenerationObjects();
#ifdef CMAKE_BUILD_WITH_CMAKE
// Iterate through all targets and set up automoc for those which have
// the AUTOMOC, AUTOUIC or AUTORCC property set
@ -1215,23 +1243,11 @@ void cmGlobalGenerator::Generate()
this->CreateQtAutoGeneratorsTargets(autogens);
#endif
// For each existing cmLocalGenerator
unsigned int i;
// Put a copy of each global target in every directory.
cmTargets globalTargets;
this->CreateDefaultGlobalTargets(&globalTargets);
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
this->LocalGenerators[i]->ComputeObjectMaxPath();
cmMakefile* mf = this->LocalGenerators[i]->GetMakefile();
cmTargets* targets = &(mf->GetTargets());
cmTargets::iterator tit;
for ( tit = globalTargets.begin(); tit != globalTargets.end(); ++ tit )
{
(*targets)[tit->first] = tit->second;
(*targets)[tit->first].SetMakefile(mf);
}
}
// Add generator specific helper commands
@ -1240,8 +1256,7 @@ void cmGlobalGenerator::Generate()
this->LocalGenerators[i]->AddHelperCommands();
}
// Create per-target generator information.
this->CreateGeneratorTargets();
this->InitGeneratorTargets();
#ifdef CMAKE_BUILD_WITH_CMAKE
for (AutogensType::iterator it = autogens.begin(); it != autogens.end();
@ -1377,6 +1392,10 @@ void cmGlobalGenerator::CreateQtAutoGeneratorsTargets(AutogensType &autogens)
for(cmTargets::iterator ti = targets.begin();
ti != targets.end(); ++ti)
{
if (ti->second.GetType() == cmTarget::GLOBAL_TARGET)
{
continue;
}
targetNames.push_back(ti->second.GetName());
}
for(std::vector<std::string>::iterator ti = targetNames.begin();
@ -1396,7 +1415,8 @@ void cmGlobalGenerator::CreateQtAutoGeneratorsTargets(AutogensType &autogens)
&& !target.IsImported())
{
cmQtAutoGenerators autogen;
if(autogen.InitializeAutogenTarget(&target))
if(autogen.InitializeAutogenTarget(this->LocalGenerators[i],
&target))
{
autogens.push_back(std::make_pair(autogen, &target));
}
@ -1427,6 +1447,10 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
ti != targets.end(); ++ti)
{
cmTarget* t = &ti->second;
if (t->GetType() == cmTarget::GLOBAL_TARGET)
{
continue;
}
t->AppendBuildInterfaceIncludes();
@ -1465,19 +1489,22 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
}
//----------------------------------------------------------------------------
void cmGlobalGenerator::CreateGeneratorTargets(cmLocalGenerator *lg)
void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes,
cmLocalGenerator *lg)
{
cmGeneratorTargetsType generatorTargets;
cmMakefile* mf = lg->GetMakefile();
cmTargets& targets = mf->GetTargets();
for(cmTargets::iterator ti = targets.begin();
ti != targets.end(); ++ti)
if (targetTypes == AllTargets)
{
cmTarget* t = &ti->second;
cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg);
this->ComputeTargetObjectDirectory(gt);
this->GeneratorTargets[t] = gt;
generatorTargets[t] = gt;
cmTargets& targets = mf->GetTargets();
for(cmTargets::iterator ti = targets.begin();
ti != targets.end(); ++ti)
{
cmTarget* t = &ti->second;
cmGeneratorTarget* gt = new cmGeneratorTarget(t, lg);
this->GeneratorTargets[t] = gt;
generatorTargets[t] = gt;
}
}
for(std::vector<cmTarget*>::const_iterator
@ -1492,12 +1519,25 @@ void cmGlobalGenerator::CreateGeneratorTargets(cmLocalGenerator *lg)
}
//----------------------------------------------------------------------------
void cmGlobalGenerator::CreateGeneratorTargets()
void cmGlobalGenerator::InitGeneratorTargets()
{
for(cmGeneratorTargetsType::iterator ti =
this->GeneratorTargets.begin(); ti != this->GeneratorTargets.end(); ++ti)
{
if (!ti->second->Target->IsImported())
{
this->ComputeTargetObjectDirectory(ti->second);
}
}
}
//----------------------------------------------------------------------------
void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes)
{
// Construct per-target generator information.
for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
{
this->CreateGeneratorTargets(this->LocalGenerators[i]);
this->CreateGeneratorTargets(targetTypes, this->LocalGenerators[i]);
}
}
@ -3054,7 +3094,8 @@ bool cmGlobalGenerator::GenerateCPackPropertiesFile()
cmake::InstalledFilesMap const& installedFiles =
this->CMakeInstance->GetInstalledFiles();
cmMakefile* mf = this->LocalGenerators[0]->GetMakefile();
cmLocalGenerator* lg = this->LocalGenerators[0];
cmMakefile* mf = lg->GetMakefile();
std::vector<std::string> configs;
std::string config = mf->GetConfigurations(configs, false);
@ -3076,7 +3117,7 @@ bool cmGlobalGenerator::GenerateCPackPropertiesFile()
cmInstalledFile const& installedFile = i->second;
cmCPackPropertiesGenerator cpackPropertiesGenerator(
mf, installedFile, configs);
lg, installedFile, configs);
cpackPropertiesGenerator.Generate(file, config, configs);
}

View File

@ -86,6 +86,14 @@ public:
*/
virtual void Configure();
enum TargetTypes {
AllTargets,
ImportedOnly
};
void CreateGenerationObjects(TargetTypes targetTypes = AllTargets);
/**
* Generate the all required files for building this project/tree. This
* basically creates a series of LocalGenerators for each directory and
@ -298,6 +306,11 @@ public:
/** Get per-target generator information. */
cmGeneratorTarget* GetGeneratorTarget(cmTarget const*) const;
void AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt)
{
this->GeneratorTargets[t] = gt;
}
const std::map<std::string, std::vector<cmLocalGenerator*> >& GetProjectMap()
const {return this->ProjectMap;}
@ -484,8 +497,9 @@ private:
// Per-target generator information.
cmGeneratorTargetsType GeneratorTargets;
friend class cmake;
void CreateGeneratorTargets(cmLocalGenerator* lg);
void CreateGeneratorTargets();
void CreateGeneratorTargets(TargetTypes targetTypes, cmLocalGenerator* lg);
void InitGeneratorTargets();
void CreateGeneratorTargets(TargetTypes targetTypes);
void ClearGeneratorMembers();

View File

@ -70,13 +70,13 @@ void cmGlobalKdevelopGenerator::Generate()
lg!=lgs.end(); lg++)
{
cmMakefile* makefile=(*lg)->GetMakefile();
cmTargets& targets=makefile->GetTargets();
for (cmTargets::iterator ti = targets.begin();
cmGeneratorTargetsType const& targets = makefile->GetGeneratorTargets();
for (cmGeneratorTargetsType::const_iterator ti = targets.begin();
ti != targets.end(); ti++)
{
if (ti->second.GetType()==cmTarget::EXECUTABLE)
if (ti->second->GetType()==cmTarget::EXECUTABLE)
{
executable = ti->second.GetLocation("");
executable = ti->second->GetLocation("");
break;
}
}

View File

@ -910,10 +910,14 @@ cmGlobalNinjaGenerator
case cmTarget::SHARED_LIBRARY:
case cmTarget::STATIC_LIBRARY:
case cmTarget::MODULE_LIBRARY:
{
cmGeneratorTarget *gtgt = target->GetMakefile()->GetLocalGenerator()
->GetGlobalGenerator()
->GetGeneratorTarget(target);
outputs.push_back(ng->ConvertToNinjaPath(
target->GetFullPath(configName, false, realname)));
gtgt->GetFullPath(configName, false, realname)));
break;
}
case cmTarget::OBJECT_LIBRARY:
case cmTarget::UTILITY: {
std::string path = ng->ConvertToNinjaPath(

View File

@ -1668,7 +1668,7 @@ void cmGlobalXCodeGenerator
for(std::vector<cmCustomCommand>::const_iterator i = commands.begin();
i != commands.end(); ++i)
{
cmCustomCommandGenerator ccg(*i, configName, this->CurrentMakefile);
cmCustomCommandGenerator ccg(*i, configName, this->CurrentLocalGenerator);
if(ccg.GetNumberOfCommands() > 0)
{
const std::vector<std::string>& outputs = ccg.GetOutputs();
@ -1694,7 +1694,7 @@ void cmGlobalXCodeGenerator
for(std::vector<cmCustomCommand>::const_iterator i = commands.begin();
i != commands.end(); ++i)
{
cmCustomCommandGenerator ccg(*i, configName, this->CurrentMakefile);
cmCustomCommandGenerator ccg(*i, configName, this->CurrentLocalGenerator);
if(ccg.GetNumberOfCommands() > 0)
{
makefileStream << "\n";
@ -3598,6 +3598,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
{
cmXCodeObject* target = *i;
cmTarget* t =target->GetTarget();
cmGeneratorTarget *gt = this->GetGeneratorTarget(t);
if(t->GetType() == cmTarget::EXECUTABLE ||
// Nope - no post-build for OBJECT_LIRBRARY
@ -3615,7 +3616,7 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
t->GetType() == cmTarget::SHARED_LIBRARY ||
t->GetType() == cmTarget::MODULE_LIBRARY)
{
std::string tfull = t->GetFullPath(configName);
std::string tfull = gt->GetFullPath(configName);
std::string trel = this->ConvertToRelativeForMake(tfull.c_str());
// Add this target to the post-build phases of its dependencies.

View File

@ -125,6 +125,7 @@ bool cmIncludeCommand
return false;
}
}
gg->CreateGenerationObjects();
gg->GenerateImportFile(fname_abs);
}

View File

@ -448,226 +448,6 @@ cmState::Snapshot cmLocalGenerator::GetStateSnapshot() const
return this->StateSnapshot;
}
void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
const std::string& lang,
cmSourceFile& source,
cmGeneratorTarget& target)
{
std::string objectDir = cmSystemTools::GetFilenamePath(std::string(ofname));
objectDir = this->Convert(objectDir,START_OUTPUT,SHELL);
std::string objectFile = this->Convert(ofname,START_OUTPUT,SHELL);
std::string sourceFile =
this->ConvertToOutputFormat(source.GetFullPath(), SHELL);
std::string varString = "CMAKE_";
varString += lang;
varString += "_COMPILE_OBJECT";
std::vector<std::string> rules;
rules.push_back(this->Makefile->GetRequiredDefinition(varString));
varString = "CMAKE_";
varString += lang;
varString += "_FLAGS";
std::string flags;
flags += this->Makefile->GetSafeDefinition(varString);
flags += " ";
{
std::vector<std::string> includes;
this->GetIncludeDirectories(includes, &target, lang);
flags += this->GetIncludeFlags(includes, &target, lang);
}
flags += this->Makefile->GetDefineFlags();
// Construct the command lines.
cmCustomCommandLines commandLines;
std::vector<std::string> commands;
cmSystemTools::ExpandList(rules, commands);
cmLocalGenerator::RuleVariables vars;
vars.Language = lang.c_str();
vars.Source = sourceFile.c_str();
vars.Object = objectFile.c_str();
vars.ObjectDir = objectDir.c_str();
vars.Flags = flags.c_str();
for(std::vector<std::string>::iterator i = commands.begin();
i != commands.end(); ++i)
{
// Expand the full command line string.
this->ExpandRuleVariables(*i, vars);
// Parse the string to get the custom command line.
cmCustomCommandLine commandLine;
std::vector<std::string> cmd = cmSystemTools::ParseArguments(i->c_str());
commandLine.insert(commandLine.end(), cmd.begin(), cmd.end());
// Store this command line.
commandLines.push_back(commandLine);
}
// Check for extra object-file dependencies.
std::vector<std::string> depends;
const char* additionalDeps = source.GetProperty("OBJECT_DEPENDS");
if(additionalDeps)
{
cmSystemTools::ExpandListArgument(additionalDeps, depends);
}
// Generate a meaningful comment for the command.
std::string comment = "Building ";
comment += lang;
comment += " object ";
comment += this->Convert(ofname, START_OUTPUT);
// Add the custom command to build the object file.
this->Makefile->AddCustomCommandToOutput(
ofname,
depends,
source.GetFullPath(),
commandLines,
comment.c_str(),
this->StateSnapshot.GetDirectory().GetCurrentBinary()
);
}
void cmLocalGenerator::AddBuildTargetRule(const std::string& llang,
cmGeneratorTarget& target)
{
std::string objs;
std::vector<std::string> objVector;
std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
// Add all the sources outputs to the depends of the target
std::vector<cmSourceFile*> classes;
target.GetSourceFiles(classes, config);
for(std::vector<cmSourceFile*>::const_iterator i = classes.begin();
i != classes.end(); ++i)
{
cmSourceFile* sf = *i;
if(!sf->GetCustomCommand() &&
!sf->GetPropertyAsBool("HEADER_FILE_ONLY") &&
!sf->GetPropertyAsBool("EXTERNAL_OBJECT"))
{
std::string dir_max;
dir_max += this->StateSnapshot.GetDirectory().GetCurrentBinary();
dir_max += "/";
std::string obj = this->GetObjectFileNameWithoutTarget(*sf, dir_max);
if(!obj.empty())
{
std::string ofname =
this->StateSnapshot.GetDirectory().GetCurrentBinary();
ofname += "/";
ofname += obj;
objVector.push_back(ofname);
this->AddCustomCommandToCreateObject(ofname.c_str(),
llang, *(*i), target);
objs += this->Convert(ofname,START_OUTPUT,SHELL);
objs += " ";
}
}
}
std::string createRule = target.GetCreateRuleVariable(llang, config);
bool useWatcomQuote = this->Makefile->IsOn(createRule+"_USE_WATCOM_QUOTE");
std::string targetName = target.Target->GetFullName();
// Executable :
// Shared Library:
// Static Library:
// Shared Module:
std::string linkLibs; // should be set
std::string frameworkPath;
std::string linkPath;
std::string flags; // should be set
std::string linkFlags; // should be set
this->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags,
&target, useWatcomQuote);
linkLibs = frameworkPath + linkPath + linkLibs;
cmLocalGenerator::RuleVariables vars;
vars.Language = llang.c_str();
vars.Objects = objs.c_str();
vars.ObjectDir = ".";
vars.Target = targetName.c_str();
vars.LinkLibraries = linkLibs.c_str();
vars.Flags = flags.c_str();
vars.LinkFlags = linkFlags.c_str();
std::string langFlags;
this->AddLanguageFlags(langFlags, llang, "");
this->AddArchitectureFlags(langFlags, &target, llang, "");
vars.LanguageCompileFlags = langFlags.c_str();
cmCustomCommandLines commandLines;
std::vector<std::string> rules;
rules.push_back(this->Makefile->GetRequiredDefinition(createRule));
std::vector<std::string> commands;
cmSystemTools::ExpandList(rules, commands);
for(std::vector<std::string>::iterator i = commands.begin();
i != commands.end(); ++i)
{
// Expand the full command line string.
this->ExpandRuleVariables(*i, vars);
// Parse the string to get the custom command line.
cmCustomCommandLine commandLine;
std::vector<std::string> cmd = cmSystemTools::ParseArguments(i->c_str());
commandLine.insert(commandLine.end(), cmd.begin(), cmd.end());
// Store this command line.
commandLines.push_back(commandLine);
}
std::string targetFullPath = target.Target->GetFullPath();
// Generate a meaningful comment for the command.
std::string comment = "Linking ";
comment += llang;
comment += " target ";
comment += this->Convert(targetFullPath, START_OUTPUT);
this->Makefile->AddCustomCommandToOutput(
targetFullPath,
objVector,
"",
commandLines,
comment.c_str(),
this->StateSnapshot.GetDirectory().GetCurrentBinary()
);
this->Makefile->GetSource(targetFullPath);
target.Target->AddSource(targetFullPath);
}
void cmLocalGenerator
::CreateCustomTargetsAndCommands(std::set<std::string> const& lang)
{
cmGeneratorTargetsType tgts = this->Makefile->GetGeneratorTargets();
for(cmGeneratorTargetsType::iterator l = tgts.begin();
l != tgts.end(); l++)
{
if (l->first->IsImported())
{
continue;
}
cmGeneratorTarget& target = *l->second;
switch(target.GetType())
{
case cmTarget::STATIC_LIBRARY:
case cmTarget::SHARED_LIBRARY:
case cmTarget::MODULE_LIBRARY:
case cmTarget::EXECUTABLE:
{
std::string llang = target.Target->GetLinkerLanguage();
if(llang.empty())
{
cmSystemTools::Error
("CMake can not determine linker language for target: ",
target.Target->GetName().c_str());
return;
}
// if the language is not in the set lang then create custom
// commands to build the target
if(lang.count(llang) == 0)
{
this->AddBuildTargetRule(llang, target);
}
}
break;
default:
break;
}
}
}
// List of variables that are replaced when
// rules are expanced. These variables are
// replaced in the form <var> with GetSafeDefinition(var).
@ -1919,7 +1699,8 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
}
// Look for a CMake target with the given name.
if(cmTarget* target = this->Makefile->FindTargetToUse(name))
if(cmGeneratorTarget* target =
this->Makefile->FindGeneratorTargetToUse(name))
{
// make sure it is not just a coincidence that the target name
// found is part of the inName

View File

@ -328,23 +328,6 @@ protected:
void InsertRuleLauncher(std::string& s, cmTarget* target,
const std::string& prop);
/** Convert a target to a utility target for unsupported
* languages of a generator */
void AddBuildTargetRule(const std::string& llang,
cmGeneratorTarget& target);
///! add a custom command to build a .o file that is part of a target
void AddCustomCommandToCreateObject(const char* ofname,
const std::string& lang,
cmSourceFile& source,
cmGeneratorTarget& target);
// Create Custom Targets and commands for unsupported languages
// The set passed in should contain the languages supported by the
// generator directly. Any targets containing files that are not
// of the types listed will be compiled as custom commands and added
// to a custom target.
void CreateCustomTargetsAndCommands(std::set<std::string> const&);
// Handle old-style install rules stored in the targets.
void GenerateTargetInstallRules(
std::ostream& os, const std::string& config,

View File

@ -404,7 +404,7 @@ cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
if (this->GetGlobalNinjaGenerator()->SeenCustomCommand(cc))
return;
cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), this->Makefile);
cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), this);
const std::vector<std::string> &outputs = ccg.GetOutputs();
const std::vector<std::string> &byproducts = ccg.GetByproducts();

View File

@ -1007,8 +1007,7 @@ cmLocalUnixMakefileGenerator3
for(std::vector<cmCustomCommand>::const_iterator i = ccs.begin();
i != ccs.end(); ++i)
{
cmCustomCommandGenerator ccg(*i, this->ConfigName,
this->Makefile);
cmCustomCommandGenerator ccg(*i, this->ConfigName, this);
this->AppendCustomDepend(depends, ccg);
}
}
@ -1043,8 +1042,7 @@ cmLocalUnixMakefileGenerator3
for(std::vector<cmCustomCommand>::const_iterator i = ccs.begin();
i != ccs.end(); ++i)
{
cmCustomCommandGenerator ccg(*i, this->ConfigName,
this->Makefile);
cmCustomCommandGenerator ccg(*i, this->ConfigName, this);
this->AppendCustomCommand(commands, ccg, target, true, relative);
}
}

View File

@ -62,7 +62,7 @@ public:
}
void Write(cmCustomCommand const& cc)
{
cmCustomCommandGenerator ccg(cc, this->Config, this->LG->GetMakefile());
cmCustomCommandGenerator ccg(cc, this->Config, this->LG);
if(this->First)
{
this->Code += this->Event + "_Cmds=";
@ -82,14 +82,6 @@ private:
std::string Event;
};
void cmLocalVisualStudio6Generator::AddHelperCommands()
{
std::set<std::string> lang;
lang.insert("C");
lang.insert("CXX");
this->CreateCustomTargetsAndCommands(lang);
}
void cmLocalVisualStudio6Generator::AddCMakeListsRules()
{
cmTargets &tgts = this->Makefile->GetTargets();
@ -625,7 +617,7 @@ cmLocalVisualStudio6Generator
for(i = this->Configurations.begin(); i != this->Configurations.end(); ++i)
{
std::string config = this->GetConfigName(*i);
cmCustomCommandGenerator ccg(command, config, this->Makefile);
cmCustomCommandGenerator ccg(command, config, this);
std::string comment =
this->ConstructComment(ccg, "Building Custom Rule $(InputPath)");
if(comment == "<hack>")

View File

@ -35,7 +35,6 @@ public:
virtual ~cmLocalVisualStudio6Generator();
virtual void AddHelperCommands();
virtual void AddCMakeListsRules();
/**

View File

@ -68,15 +68,6 @@ cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator()
void cmLocalVisualStudio7Generator::AddHelperCommands()
{
std::set<std::string> lang;
lang.insert("C");
lang.insert("CXX");
lang.insert("RC");
lang.insert("IDL");
lang.insert("DEF");
lang.insert("Fortran");
this->CreateCustomTargetsAndCommands(lang);
// Now create GUIDs for targets
cmTargets &tgts = this->Makefile->GetTargets();
@ -619,7 +610,7 @@ public:
}
void Write(cmCustomCommand const& cc)
{
cmCustomCommandGenerator ccg(cc, this->Config, this->LG->GetMakefile());
cmCustomCommandGenerator ccg(cc, this->Config, this->LG);
if(this->First)
{
const char* comment = ccg.GetComment();
@ -1903,7 +1894,7 @@ WriteCustomRule(std::ostream& fout,
for (std::vector<std::string>::const_iterator i = configs.begin();
i != configs.end(); ++i)
{
cmCustomCommandGenerator ccg(command, *i, this->Makefile);
cmCustomCommandGenerator ccg(command, *i, this);
cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i];
fout << "\t\t\t\t<FileConfiguration\n";
fout << "\t\t\t\t\tName=\"" << *i << "|"

View File

@ -416,6 +416,10 @@ public:
{
this->GeneratorTargets = targets;
}
void AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt)
{
this->GeneratorTargets[t] = gt;
}
cmTarget* FindTarget(const std::string& name,
bool excludeAliases = false) const;

View File

@ -167,7 +167,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
{
cmCustomCommandGenerator ccg(*(*si)->GetCustomCommand(),
this->ConfigName,
this->Makefile);
this->LocalGenerator);
this->GenerateCustomRuleFile(ccg);
if (clean)
{
@ -546,7 +546,7 @@ cmMakefileTargetGenerator
this->Target->GetType() == cmTarget::MODULE_LIBRARY)
{
targetFullPathReal =
this->Target->GetFullPath(this->ConfigName, false, true);
this->GeneratorTarget->GetFullPath(this->ConfigName, false, true);
targetFullPathPDB = this->Target->GetPDBDirectory(this->ConfigName);
targetFullPathPDB += "/";
targetFullPathPDB += this->Target->GetPDBName(this->ConfigName);
@ -1182,7 +1182,8 @@ cmMakefileTargetGenerator
{
if(cmCustomCommand* cc = (*source)->GetCustomCommand())
{
cmCustomCommandGenerator ccg(*cc, this->ConfigName, this->Makefile);
cmCustomCommandGenerator ccg(*cc, this->ConfigName,
this->LocalGenerator);
const std::vector<std::string>& outputs = ccg.GetOutputs();
depends.insert(depends.end(), outputs.begin(), outputs.end());
}

View File

@ -398,15 +398,16 @@ static int calculateCommandLineLengthLimit(int linkRuleLength)
void cmNinjaNormalTargetGenerator::WriteLinkStatement()
{
cmTarget& target = *this->GetTarget();
cmGeneratorTarget& gt = *this->GetGeneratorTarget();
const std::string cfgName = this->GetConfigName();
std::string targetOutput = ConvertToNinjaPath(
target.GetFullPath(cfgName));
gt.GetFullPath(cfgName));
std::string targetOutputReal = ConvertToNinjaPath(
target.GetFullPath(cfgName,
gt.GetFullPath(cfgName,
/*implib=*/false,
/*realpath=*/true));
std::string targetOutputImplib = ConvertToNinjaPath(
target.GetFullPath(cfgName,
gt.GetFullPath(cfgName,
/*implib=*/true));
if (target.IsAppBundleOnApple())
@ -608,7 +609,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
ci = cmdLists[i]->begin();
ci != cmdLists[i]->end(); ++ci)
{
cmCustomCommandGenerator ccg(*ci, cfgName, mf);
cmCustomCommandGenerator ccg(*ci, cfgName, this->GetLocalGenerator());
localGen.AppendCustomCommandLines(ccg, *cmdLineLists[i]);
std::vector<std::string> const& ccByproducts = ccg.GetByproducts();
std::transform(ccByproducts.begin(), ccByproducts.end(),

View File

@ -509,7 +509,7 @@ cmNinjaTargetGenerator
{
cmCustomCommand const* cc = *cci;
cmCustomCommandGenerator ccg(*cc, this->GetConfigName(),
this->GetMakefile());
this->GetLocalGenerator());
const std::vector<std::string>& ccoutputs = ccg.GetOutputs();
const std::vector<std::string>& ccbyproducts= ccg.GetByproducts();
std::transform(ccoutputs.begin(), ccoutputs.end(),

View File

@ -44,7 +44,7 @@ void cmNinjaUtilityTargetGenerator::Generate()
for (std::vector<cmCustomCommand>::const_iterator
ci = cmdLists[i]->begin(); ci != cmdLists[i]->end(); ++ci) {
cmCustomCommandGenerator ccg(*ci, this->GetConfigName(),
this->GetMakefile());
this->GetLocalGenerator());
this->GetLocalGenerator()->AppendCustomCommandDeps(ccg, deps);
this->GetLocalGenerator()->AppendCustomCommandLines(ccg, commands);
std::vector<std::string> const& ccByproducts = ccg.GetByproducts();
@ -65,7 +65,7 @@ void cmNinjaUtilityTargetGenerator::Generate()
if(cmCustomCommand* cc = (*source)->GetCustomCommand())
{
cmCustomCommandGenerator ccg(*cc, this->GetConfigName(),
this->GetMakefile());
this->GetLocalGenerator());
this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget());
// Depend on all custom command outputs.

View File

@ -287,7 +287,8 @@ std::string cmQtAutoGenerators::ListQt4RccInputs(cmSourceFile* sf,
return entriesList;
}
bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
bool cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg,
cmTarget* target)
{
cmMakefile* makefile = target->GetMakefile();
// don't do anything if there is no Qt4 or Qt5Core (which contains moc):
@ -474,6 +475,10 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
/*byproducts=*/rcc_output, depends,
commandLines, false, autogenComment.c_str());
cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg);
lg->GetGlobalGenerator()->AddGeneratorTarget(autogenTarget, gt);
makefile->AddGeneratorTarget(autogenTarget, gt);
// Set target folder
const char* autogenFolder = makefile->GetState()
->GetGlobalProperty("AUTOMOC_TARGETS_FOLDER");
@ -804,7 +809,8 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target,
autogenTargetName.c_str());
return;
}
makefile->AddDefinition("_qt_moc_executable", qt5Moc->GetLocation(""));
makefile->AddDefinition("_qt_moc_executable",
qt5Moc->ImportedGetLocation(""));
}
else if (strcmp(qtVersion, "4") == 0)
{
@ -815,7 +821,8 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target,
autogenTargetName.c_str());
return;
}
makefile->AddDefinition("_qt_moc_executable", qt4Moc->GetLocation(""));
makefile->AddDefinition("_qt_moc_executable",
qt4Moc->ImportedGetLocation(""));
}
else
{
@ -962,7 +969,8 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
}
else
{
makefile->AddDefinition("_qt_uic_executable", qt5Uic->GetLocation(""));
makefile->AddDefinition("_qt_uic_executable",
qt5Uic->ImportedGetLocation(""));
}
}
else if (strcmp(qtVersion, "4") == 0)
@ -974,7 +982,8 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
targetName.c_str());
return;
}
makefile->AddDefinition("_qt_uic_executable", qt4Uic->GetLocation(""));
makefile->AddDefinition("_qt_uic_executable",
qt4Uic->ImportedGetLocation(""));
}
else
{
@ -1166,7 +1175,7 @@ std::string cmQtAutoGenerators::GetRccExecutable(cmTarget const* target)
targetName.c_str());
return std::string();
}
return qt5Rcc->GetLocation("");
return qt5Rcc->ImportedGetLocation("");
}
else if (strcmp(qtVersion, "4") == 0)
{
@ -1177,7 +1186,7 @@ std::string cmQtAutoGenerators::GetRccExecutable(cmTarget const* target)
targetName.c_str());
return std::string();
}
return qt4Rcc->GetLocation("");
return qt4Rcc->ImportedGetLocation("");
}
cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and "

View File

@ -18,6 +18,7 @@
class cmGlobalGenerator;
class cmMakefile;
class cmLocalGenerator;
class cmQtAutoGenerators
{
@ -25,7 +26,7 @@ public:
cmQtAutoGenerators();
bool Run(const std::string& targetDirectory, const std::string& config);
bool InitializeAutogenTarget(cmTarget* target);
bool InitializeAutogenTarget(cmLocalGenerator* lg, cmTarget* target);
void SetupAutoGenerateTarget(cmTarget const* target);
void SetupSourceFiles(cmTarget const* target);

View File

@ -731,7 +731,7 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
{
assert(this->GetType() != INTERFACE_LIBRARY);
if (this->Makefile->GetGeneratorTargets().empty())
if (!this->Makefile->IsConfigured())
{
// At configure-time, this method can be called as part of getting the
// LOCATION property or to export() a file to be include()d. However
@ -2750,50 +2750,11 @@ std::string cmTarget::GetCompilePDBDirectory(const std::string& config) const
}
//----------------------------------------------------------------------------
const char* cmTarget::GetLocation(const std::string& config) const
const char* cmTarget::ImportedGetLocation(const std::string& config) const
{
static std::string location;
if (this->IsImported())
{
location = this->ImportedGetFullPath(config, false);
}
else
{
location = this->GetFullPath(config, false);
}
return location.c_str();
}
//----------------------------------------------------------------------------
const char* cmTarget::GetLocationForBuild() const
{
static std::string location;
if(this->IsImported())
{
location = this->ImportedGetFullPath("", false);
return location.c_str();
}
// Now handle the deprecated build-time configuration location.
location = this->GetDirectory();
const char* cfgid = this->Makefile->GetDefinition("CMAKE_CFG_INTDIR");
if(cfgid && strcmp(cfgid, ".") != 0)
{
location += "/";
location += cfgid;
}
if(this->IsAppBundleOnApple())
{
std::string macdir = this->BuildMacContentDirectory("", "", false);
if(!macdir.empty())
{
location += "/";
location += macdir;
}
}
location += "/";
location += this->GetFullName("", false);
assert(this->IsImported());
location = this->ImportedGetFullPath(config, false);
return location.c_str();
}
@ -2928,11 +2889,24 @@ const char *cmTarget::GetProperty(const std::string& prop,
// For an imported target this is the location of an arbitrary
// available configuration.
//
// For a non-imported target this is deprecated because it
// cannot take into account the per-configuration name of the
// target because the configuration type may not be known at
// CMake time.
this->Properties.SetProperty(propLOCATION, this->GetLocationForBuild());
if(this->IsImported())
{
this->Properties.SetProperty(
propLOCATION, this->ImportedGetFullPath("", false).c_str());
}
else
{
// For a non-imported target this is deprecated because it
// cannot take into account the per-configuration name of the
// target because the configuration type may not be known at
// CMake time.
cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
gg->CreateGenerationObjects();
cmGeneratorTarget* gt = gg->GetGeneratorTarget(this);
this->Properties.SetProperty(propLOCATION,
gt->GetLocationForBuild());
}
}
// Support "LOCATION_<CONFIG>".
@ -2943,7 +2917,20 @@ const char *cmTarget::GetProperty(const std::string& prop,
return 0;
}
const char* configName = prop.c_str() + 9;
this->Properties.SetProperty(prop, this->GetLocation(configName));
if (this->IsImported())
{
this->Properties.SetProperty(
prop, this->ImportedGetFullPath(configName, false).c_str());
}
else
{
cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
gg->CreateGenerationObjects();
cmGeneratorTarget* gt = gg->GetGeneratorTarget(this);
this->Properties.SetProperty(
prop, gt->GetFullPath(configName, false).c_str());
}
}
// Support "<CONFIG>_LOCATION".
else if(cmHasLiteralSuffix(prop, "_LOCATION"))
@ -2955,7 +2942,19 @@ const char *cmTarget::GetProperty(const std::string& prop,
{
return 0;
}
this->Properties.SetProperty(prop, this->GetLocation(configName));
if (this->IsImported())
{
this->Properties.SetProperty(
prop, this->ImportedGetFullPath(configName, false).c_str());
}
else
{
cmGlobalGenerator* gg = this->Makefile->GetGlobalGenerator();
gg->CreateGenerationObjects();
cmGeneratorTarget* gt = gg->GetGeneratorTarget(this);
this->Properties.SetProperty(
prop, gt->GetFullPath(configName, false).c_str());
}
}
}
}
@ -3770,44 +3769,6 @@ bool cmTarget::IsImportedSharedLibWithoutSOName(
return false;
}
//----------------------------------------------------------------------------
std::string cmTarget::NormalGetRealName(const std::string& config) const
{
// This should not be called for imported targets.
// TODO: Split cmTarget into a class hierarchy to get compile-time
// enforcement of the limited imported target API.
if(this->IsImported())
{
std::string msg = "NormalGetRealName called on imported target: ";
msg += this->GetName();
this->GetMakefile()->
IssueMessage(cmake::INTERNAL_ERROR,
msg);
}
if(this->GetType() == cmTarget::EXECUTABLE)
{
// Compute the real name that will be built.
std::string name;
std::string realName;
std::string impName;
std::string pdbName;
this->GetExecutableNames(name, realName, impName, pdbName, config);
return realName;
}
else
{
// Compute the real name that will be built.
std::string name;
std::string soName;
std::string realName;
std::string impName;
std::string pdbName;
this->GetLibraryNames(name, soName, realName, impName, pdbName, config);
return realName;
}
}
//----------------------------------------------------------------------------
std::string cmTarget::GetFullName(const std::string& config,
bool implib) const
@ -3839,48 +3800,6 @@ void cmTarget::GetFullNameComponents(std::string& prefix, std::string& base,
this->GetFullNameInternal(config, implib, prefix, base, suffix);
}
//----------------------------------------------------------------------------
std::string cmTarget::GetFullPath(const std::string& config, bool implib,
bool realname) const
{
if(this->IsImported())
{
return this->ImportedGetFullPath(config, implib);
}
else
{
return this->NormalGetFullPath(config, implib, realname);
}
}
//----------------------------------------------------------------------------
std::string cmTarget::NormalGetFullPath(const std::string& config,
bool implib, bool realname) const
{
std::string fpath = this->GetDirectory(config, implib);
fpath += "/";
if(this->IsAppBundleOnApple())
{
fpath = this->BuildMacContentDirectory(fpath, config, false);
fpath += "/";
}
// Add the full name of the target.
if(implib)
{
fpath += this->GetFullName(config, true);
}
else if(realname)
{
fpath += this->NormalGetRealName(config);
}
else
{
fpath += this->GetFullName(config, false);
}
return fpath;
}
//----------------------------------------------------------------------------
std::string
cmTarget::ImportedGetFullPath(const std::string& config, bool implib) const
@ -5260,7 +5179,7 @@ void cmTarget::GetLanguages(std::set<std::string>& languages,
std::vector<cmTarget*> objectLibraries;
std::vector<cmSourceFile const*> externalObjects;
if (this->Makefile->GetGeneratorTargets().empty())
if (!this->Makefile->IsConfigured())
{
this->GetObjectLibrariesCMP0026(objectLibraries);
}

View File

@ -374,14 +374,7 @@ public:
compiler pdb output directory is given. */
std::string GetCompilePDBDirectory(const std::string& config = "") const;
/** Get the location of the target in the build tree for the given
configuration. */
const char* GetLocation(const std::string& config) const;
/** Get the location of the target in the build tree with a placeholder
referencing the configuration in the native build system. This
location is suitable for use as the LOCATION target property. */
const char* GetLocationForBuild() const;
const char* ImportedGetLocation(const std::string& config) const;
/** Get the target major and minor version numbers interpreted from
the VERSION property. Version 0 is returned if the property is
@ -431,11 +424,6 @@ public:
no soname at all. */
bool IsImportedSharedLibWithoutSOName(const std::string& config) const;
/** Get the full path to the target according to the settings in its
makefile and the configuration type. */
std::string GetFullPath(const std::string& config="", bool implib = false,
bool realname = false) const;
/** Get the names of the library needed to generate a build rule
that takes into account shared library version numbers. This
should be called only on a library target. */
@ -718,14 +706,6 @@ private:
std::string ImportedGetFullPath(const std::string& config,
bool implib) const;
std::string NormalGetFullPath(const std::string& config, bool implib,
bool realname) const;
/** Get the real name of the target. Allowed only for non-imported
targets. When a library or executable file is versioned this is
the full versioned name. If the target is not versioned this is
the same as GetFullName. */
std::string NormalGetRealName(const std::string& config) const;
/** Append to @a base the mac content directory and return it. */
std::string BuildMacContentDirectory(const std::string& base,

View File

@ -82,7 +82,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
// be translated.
std::string exe = command[0];
cmMakefile* mf = this->Test->GetMakefile();
cmTarget* target = mf->FindTargetToUse(exe);
cmGeneratorTarget* target = mf->FindGeneratorTargetToUse(exe);
if(target && target->GetType() == cmTarget::EXECUTABLE)
{
// Use the target file on disk.

View File

@ -890,7 +890,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile const* source,
i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
cmCustomCommandGenerator ccg(command, *i, this->Makefile);
cmCustomCommandGenerator ccg(command, *i, this->LocalGenerator);
std::string comment = lg->ConstructComment(ccg);
comment = cmVS10EscapeComment(comment);
std::string script =
@ -2794,7 +2794,7 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
for(std::vector<cmCustomCommand>::const_iterator i = commands.begin();
i != commands.end(); ++i)
{
cmCustomCommandGenerator ccg(*i, configName, this->Makefile);
cmCustomCommandGenerator ccg(*i, configName, this->LocalGenerator);
comment += pre;
comment += lg->ConstructComment(ccg);
script += pre;

View File

@ -484,7 +484,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
std::string linkPath;
std::string flags;
std::string linkFlags;
gg->CreateGeneratorTargets(lg.get());
gg->CreateGeneratorTargets(cmGlobalGenerator::AllTargets, lg.get());
cmGeneratorTarget *gtgt = gg->GetGeneratorTarget(tgt);
lg->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags,
gtgt, false);