~ubuntu-branches/ubuntu/utopic/cmake/utopic

« back to all changes in this revision

Viewing changes to Source/cmExportInstallFileGenerator.cxx

  • Committer: Package Import Robot
  • Author(s): Harald Sitter
  • Date: 2013-10-10 12:54:39 UTC
  • mfrom: (1.14.7)
  • Revision ID: package-import@ubuntu.com-20131010125439-h0ahaj004on6oj92
Tags: 2.8.12-0ubuntu1
New upstream release LP: #1246701

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
//----------------------------------------------------------------------------
40
40
bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
41
41
{
42
 
  std::vector<cmTarget*> allTargets;
 
42
  std::vector<cmTargetExport*> allTargets;
43
43
  {
44
44
  std::string expectedTargets;
45
45
  std::string sep;
47
47
        tei = this->IEGen->GetExportSet()->GetTargetExports()->begin();
48
48
      tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei)
49
49
    {
50
 
    expectedTargets += sep + this->Namespace + (*tei)->Target->GetName();
 
50
    expectedTargets += sep + this->Namespace + (*tei)->Target->GetExportName();
51
51
    sep = " ";
52
 
    cmTargetExport const* te = *tei;
 
52
    cmTargetExport * te = *tei;
53
53
    if(this->ExportedTargets.insert(te->Target).second)
54
54
      {
55
 
      allTargets.push_back(te->Target);
 
55
      allTargets.push_back(te);
56
56
      }
57
57
    else
58
58
      {
113
113
 
114
114
  std::vector<std::string> missingTargets;
115
115
 
 
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)
120
121
    {
121
 
    cmTarget* te = *tei;
 
122
    cmTarget* te = (*tei)->Target;
122
123
    this->GenerateImportTargetCode(os, te);
123
124
 
124
125
    ImportPropertyMap properties;
125
126
 
126
 
    this->PopulateIncludeDirectoriesInterface(te,
 
127
    this->PopulateIncludeDirectoriesInterface(*tei,
 
128
                                  cmGeneratorExpression::InstallInterface,
 
129
                                  properties, missingTargets);
 
130
    this->PopulateInterfaceProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES",
 
131
                                  te,
127
132
                                  cmGeneratorExpression::InstallInterface,
128
133
                                  properties, missingTargets);
129
134
    this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS",
130
135
                                  te,
131
136
                                  cmGeneratorExpression::InstallInterface,
132
137
                                  properties, missingTargets);
 
138
    this->PopulateInterfaceProperty("INTERFACE_COMPILE_OPTIONS",
 
139
                                  te,
 
140
                                  cmGeneratorExpression::InstallInterface,
 
141
                                  properties, missingTargets);
 
142
 
 
143
    const bool newCMP0022Behavior =
 
144
                              te->GetPolicyStatusCMP0022() != cmPolicies::WARN
 
145
                           && te->GetPolicyStatusCMP0022() != cmPolicies::OLD;
 
146
    if (newCMP0022Behavior)
 
147
      {
 
148
      if (this->PopulateInterfaceLinkLibrariesProperty(te,
 
149
                                    cmGeneratorExpression::InstallInterface,
 
150
                                    properties, missingTargets)
 
151
          && !this->ExportOld)
 
152
        {
 
153
        require2_8_12 = true;
 
154
        }
 
155
      }
133
156
    this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
134
157
                                  te, properties);
135
158
    this->PopulateCompatibleInterfaceProperties(te, properties);
137
160
    this->GenerateInterfaceProperties(te, os, properties);
138
161
    }
139
162
 
 
163
  if (require2_8_12)
 
164
    {
 
165
    this->GenerateRequiredCMakeVersion(os, "2.8.12");
 
166
    }
140
167
 
141
168
  // Now load per-configuration properties for them.
142
169
  os << "# Load information for each installed configuration.\n"
351
378
    prop += suffix;
352
379
 
353
380
    // Append the installed file name.
354
 
    if(target->IsFrameworkOnApple())
355
 
      {
356
 
      value += itgen->GetInstallFilename(target, config);
357
 
      value += ".framework/";
358
 
      value += itgen->GetInstallFilename(target, config);
359
 
      }
360
 
    else if(target->IsCFBundleOnApple())
361
 
      {
362
 
      const char *ext = target->GetProperty("BUNDLE_EXTENSION");
363
 
      if (!ext)
364
 
        {
365
 
        ext = "bundle";
366
 
        }
367
 
 
368
 
      value += itgen->GetInstallFilename(target, config);
369
 
      value += ".";
370
 
      value += ext;
371
 
      value += "/";
372
 
      value += itgen->GetInstallFilename(target, config);
373
 
      }
374
 
    else if(target->IsAppBundleOnApple())
 
381
    if(target->IsAppBundleOnApple())
375
382
      {
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)
397
404
{
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)
402
409
    {
403
410
    std::string missingTarget = namespaces[0];
404
 
    missingTarget += name;
 
411
 
 
412
    missingTarget += dependee->GetExportName();
405
413
    link_libs += missingTarget;
406
414
    missingTargets.push_back(missingTarget);
407
415
    }
496
504
    }
497
505
  cmSystemTools::Error(e.str().c_str());
498
506
}
 
507
 
 
508
std::string
 
509
cmExportInstallFileGenerator::InstallNameDir(cmTarget* target,
 
510
                                             const std::string&)
 
511
{
 
512
  std::string install_name_dir;
 
513
 
 
514
  cmMakefile* mf = target->GetMakefile();
 
515
  if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
 
516
    {
 
517
    install_name_dir =
 
518
      target->GetInstallNameDirForInstallTree();
 
519
    }
 
520
 
 
521
  return install_name_dir;
 
522
}