39
39
//----------------------------------------------------------------------------
40
40
bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
42
std::vector<cmTarget*> allTargets;
42
std::vector<cmTargetExport*> allTargets;
44
44
std::string expectedTargets;
47
47
tei = this->IEGen->GetExportSet()->GetTargetExports()->begin();
48
48
tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei)
50
expectedTargets += sep + this->Namespace + (*tei)->Target->GetName();
50
expectedTargets += sep + this->Namespace + (*tei)->Target->GetExportName();
52
cmTargetExport const* te = *tei;
52
cmTargetExport * te = *tei;
53
53
if(this->ExportedTargets.insert(te->Target).second)
55
allTargets.push_back(te->Target);
55
allTargets.push_back(te);
114
114
std::vector<std::string> missingTargets;
116
bool require2_8_12 = false;
116
117
// Create all the imported targets.
117
for(std::vector<cmTarget*>::const_iterator
118
for(std::vector<cmTargetExport*>::const_iterator
118
119
tei = allTargets.begin();
119
120
tei != allTargets.end(); ++tei)
122
cmTarget* te = (*tei)->Target;
122
123
this->GenerateImportTargetCode(os, te);
124
125
ImportPropertyMap properties;
126
this->PopulateIncludeDirectoriesInterface(te,
127
this->PopulateIncludeDirectoriesInterface(*tei,
128
cmGeneratorExpression::InstallInterface,
129
properties, missingTargets);
130
this->PopulateInterfaceProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES",
127
132
cmGeneratorExpression::InstallInterface,
128
133
properties, missingTargets);
129
134
this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS",
131
136
cmGeneratorExpression::InstallInterface,
132
137
properties, missingTargets);
138
this->PopulateInterfaceProperty("INTERFACE_COMPILE_OPTIONS",
140
cmGeneratorExpression::InstallInterface,
141
properties, missingTargets);
143
const bool newCMP0022Behavior =
144
te->GetPolicyStatusCMP0022() != cmPolicies::WARN
145
&& te->GetPolicyStatusCMP0022() != cmPolicies::OLD;
146
if (newCMP0022Behavior)
148
if (this->PopulateInterfaceLinkLibrariesProperty(te,
149
cmGeneratorExpression::InstallInterface,
150
properties, missingTargets)
153
require2_8_12 = true;
133
156
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
135
158
this->PopulateCompatibleInterfaceProperties(te, properties);
137
160
this->GenerateInterfaceProperties(te, os, properties);
165
this->GenerateRequiredCMakeVersion(os, "2.8.12");
141
168
// Now load per-configuration properties for them.
142
169
os << "# Load information for each installed configuration.\n"
353
380
// Append the installed file name.
354
if(target->IsFrameworkOnApple())
356
value += itgen->GetInstallFilename(target, config);
357
value += ".framework/";
358
value += itgen->GetInstallFilename(target, config);
360
else if(target->IsCFBundleOnApple())
362
const char *ext = target->GetProperty("BUNDLE_EXTENSION");
368
value += itgen->GetInstallFilename(target, config);
372
value += itgen->GetInstallFilename(target, config);
374
else if(target->IsAppBundleOnApple())
381
if(target->IsAppBundleOnApple())
376
383
value += itgen->GetInstallFilename(target, config);
377
384
value += ".app/Contents/MacOS/";
395
402
std::string& link_libs, std::vector<std::string>& missingTargets,
396
403
cmMakefile* mf, cmTarget* depender, cmTarget* dependee)
398
std::string name = dependee->GetName();
405
const std::string name = dependee->GetName();
399
406
std::vector<std::string> namespaces = this->FindNamespaces(mf, name);
400
407
int targetOccurrences = (int)namespaces.size();
401
408
if (targetOccurrences == 1)
403
410
std::string missingTarget = namespaces[0];
404
missingTarget += name;
412
missingTarget += dependee->GetExportName();
405
413
link_libs += missingTarget;
406
414
missingTargets.push_back(missingTarget);
497
505
cmSystemTools::Error(e.str().c_str());
509
cmExportInstallFileGenerator::InstallNameDir(cmTarget* target,
512
std::string install_name_dir;
514
cmMakefile* mf = target->GetMakefile();
515
if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
518
target->GetInstallNameDirForInstallTree();
521
return install_name_dir;