~ubuntu-branches/ubuntu/lucid/cmake/lucid

« back to all changes in this revision

Viewing changes to Source/cmGlobalVisualStudioGenerator.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Artur Rona
  • Date: 2009-12-16 11:11:54 UTC
  • mfrom: (3.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20091216111154-6accvv6yq86h2hkc
Tags: 2.8.0-5ubuntu1
* Merge from debian testing (LP: #497349). Remaining changes:
  - Keep the Replaces: on cmake-data to cover the Kubuntu version from
    Jaunty in case someone decides to do an (unsupported) Jaunty->Lucid
    upgrade.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*=========================================================================
2
 
 
3
 
  Program:   CMake - Cross-Platform Makefile Generator
4
 
  Module:    $RCSfile: cmGlobalVisualStudioGenerator.cxx,v $
5
 
  Language:  C++
6
 
  Date:      $Date: 2008-07-31 15:52:24 $
7
 
  Version:   $Revision: 1.11.2.2 $
8
 
 
9
 
  Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
10
 
  See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
11
 
 
12
 
     This software is distributed WITHOUT ANY WARRANTY; without even
13
 
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14
 
     PURPOSE.  See the above copyright notices for more information.
15
 
 
16
 
=========================================================================*/
 
1
/*============================================================================
 
2
  CMake - Cross Platform Makefile Generator
 
3
  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
 
4
 
 
5
  Distributed under the OSI-approved BSD License (the "License");
 
6
  see accompanying file Copyright.txt for details.
 
7
 
 
8
  This software is distributed WITHOUT ANY WARRANTY; without even the
 
9
  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
10
  See the License for more information.
 
11
============================================================================*/
17
12
#include "cmGlobalVisualStudioGenerator.h"
18
13
 
19
14
#include "cmCallVisualStudioMacro.h"
32
27
}
33
28
 
34
29
//----------------------------------------------------------------------------
 
30
std::string cmGlobalVisualStudioGenerator::GetRegistryBase()
 
31
{
 
32
  std::string key = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\";
 
33
  key += this->GetIDEVersion();
 
34
  return key;
 
35
}
 
36
 
 
37
//----------------------------------------------------------------------------
35
38
void cmGlobalVisualStudioGenerator::Generate()
36
39
{
37
40
  // Add a special target that depends on ALL projects for easy build
48
51
      {
49
52
      // Use no actual command lines so that the target itself is not
50
53
      // considered always out of date.
51
 
      gen[0]->GetMakefile()->
 
54
      cmTarget* allBuild = 
 
55
        gen[0]->GetMakefile()->
52
56
        AddUtilityCommand("ALL_BUILD", true, no_working_dir,
53
57
                          no_depends, no_commands, false,
54
58
                          "Build all projects");
 
59
      // Now make all targets depend on the ALL_BUILD target
 
60
      cmTargets targets;
 
61
      for(std::vector<cmLocalGenerator*>::iterator i = gen.begin();
 
62
          i != gen.end(); ++i)
 
63
        {
 
64
        cmTargets& targets = (*i)->GetMakefile()->GetTargets();
 
65
        for(cmTargets::iterator t = targets.begin();
 
66
            t != targets.end(); ++t)
 
67
          {
 
68
          if(!this->IsExcluded(gen[0], t->second))
 
69
            {
 
70
            allBuild->AddUtility(t->second.GetName());
 
71
            }
 
72
          }
 
73
        }
55
74
      }
56
75
    }
57
76
 
360
379
cmGlobalVisualStudioGenerator::GetUtilityForTarget(cmTarget& target,
361
380
                                                   const char* name)
362
381
{
363
 
  // Handle the external MS project special case.
364
 
  if(strncmp(name, "INCLUDE_EXTERNAL_MSPROJECT", 26) == 0)
365
 
    {
366
 
    // Note from Ken:
367
 
    // kind of weird removing the first 27 letters.  my
368
 
    // recommendatsions: use cmCustomCommand::GetCommand() to get the
369
 
    // project name or get rid of the target name starting with
370
 
    // "INCLUDE_EXTERNAL_MSPROJECT_" and use another indicator/flag
371
 
    // somewhere.  These external project names shouldn't conflict
372
 
    // with cmake target names anyways.
373
 
    return name+27;
374
 
    }
375
 
 
376
382
  // Possibly depend on an intermediate utility target to avoid
377
383
  // linking.
378
384
  if(target.GetType() == cmTarget::STATIC_LIBRARY ||
403
409
}
404
410
 
405
411
//----------------------------------------------------------------------------
 
412
void cmGlobalVisualStudioGenerator::GetTargetSets(
 
413
  TargetDependSet& projectTargets, TargetDependSet& originalTargets,
 
414
  cmLocalGenerator* root, GeneratorVector const& generators
 
415
  )
 
416
{
 
417
  this->cmGlobalGenerator::GetTargetSets(projectTargets, originalTargets,
 
418
                                         root, generators);
 
419
 
 
420
  // Add alternative dependency targets created by FixUtilityDepends.
 
421
  for(TargetDependSet::iterator ti = projectTargets.begin();
 
422
      ti != projectTargets.end(); ++ti)
 
423
    {
 
424
    cmTarget* tgt = *ti;
 
425
    if(const char* altName = tgt->GetProperty("ALTERNATIVE_DEPENDENCY_NAME"))
 
426
      {
 
427
      if(cmTarget* alt = tgt->GetMakefile()->FindTarget(altName))
 
428
        {
 
429
        projectTargets.insert(alt);
 
430
        }
 
431
      }
 
432
    }
 
433
}
 
434
 
 
435
//----------------------------------------------------------------------------
406
436
#include <windows.h>
407
437
 
408
438
//----------------------------------------------------------------------------
720
750
    }
721
751
  return false;
722
752
}
 
753
 
 
754
//----------------------------------------------------------------------------
 
755
bool
 
756
cmGlobalVisualStudioGenerator::TargetCompare
 
757
::operator()(cmTarget const* l, cmTarget const* r) const
 
758
{
 
759
  // Make sure ALL_BUILD is first so it is the default active project.
 
760
  if(strcmp(r->GetName(), "ALL_BUILD") == 0)
 
761
    {
 
762
    return false;
 
763
    }
 
764
  if(strcmp(l->GetName(), "ALL_BUILD") == 0)
 
765
    {
 
766
    return true;
 
767
    }
 
768
  return strcmp(l->GetName(), r->GetName()) < 0;
 
769
}
 
770
 
 
771
//----------------------------------------------------------------------------
 
772
cmGlobalVisualStudioGenerator::OrderedTargetDependSet
 
773
::OrderedTargetDependSet(cmGlobalGenerator::TargetDependSet const& targets)
 
774
{
 
775
  for(cmGlobalGenerator::TargetDependSet::const_iterator ti =
 
776
        targets.begin(); ti != targets.end(); ++ti)
 
777
    {
 
778
    this->insert(*ti);
 
779
    }
 
780
}