1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
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 ============================================================================*/
12 #ifndef cmGlobalVisualStudioGenerator_h
13 #define cmGlobalVisualStudioGenerator_h
15 #include "cmGlobalGenerator.h"
17 /** \class cmGlobalVisualStudioGenerator
18 * \brief Base class for global Visual Studio generators.
20 * cmGlobalVisualStudioGenerator provides functionality common to all
21 * global Visual Studio generators.
23 class cmGlobalVisualStudioGenerator : public cmGlobalGenerator
26 cmGlobalVisualStudioGenerator();
27 virtual ~cmGlobalVisualStudioGenerator();
30 * Basic generate implementation for all VS generators.
32 virtual void Generate();
35 * Configure CMake's Visual Studio macros file into the user's Visual
36 * Studio macros directory.
38 virtual void ConfigureCMakeVisualStudioMacros();
41 * Where does this version of Visual Studio look for macros for the
42 * current user? Returns the empty string if this version of Visual
43 * Studio does not implement support for VB macros.
45 virtual std::string GetUserMacrosDirectory();
48 * What is the reg key path to "vsmacros" for this version of Visual
51 virtual std::string GetUserMacrosRegKeyBase();
53 enum MacroName {MacroReload, MacroStop};
56 * Call the ReloadProjects macro if necessary based on
57 * GetFilesReplacedDuringGenerate results.
59 virtual void CallVisualStudioMacro(MacroName m,
60 const char* vsSolutionFile = 0);
62 // return true if target is fortran only
63 bool TargetIsFortranOnly(cmTarget& t);
65 /** Get the top-level registry key for this VS version. */
66 std::string GetRegistryBase();
68 /** Get the top-level registry key for the given VS version. */
69 static std::string GetRegistryBase(const char* version);
71 /** Return true if the generated build tree may contain multiple builds.
72 i.e. "Can I build Debug and Release in the same tree?" */
73 virtual bool IsMultiConfig() { return true; }
75 /** Return true if building for Windows CE */
76 virtual bool TargetsWindowsCE() const { return false; }
78 class TargetSet: public std::set<cmTarget*> {};
81 bool operator()(cmTarget const* l, cmTarget const* r) const;
83 class OrderedTargetDependSet;
86 // Does this VS version link targets to each other if there are
87 // dependencies in the SLN file? This was done for VS versions
89 virtual bool VSLinksDependencies() const { return true; }
91 virtual const char* GetIDEVersion() = 0;
93 virtual void AddPlatformDefinitions(cmMakefile* mf);
95 virtual bool ComputeTargetDepends();
96 class VSDependSet: public std::set<cmStdString> {};
97 class VSDependMap: public std::map<cmTarget*, VSDependSet> {};
98 VSDependMap VSTargetDepends;
99 void ComputeVSTargetDepends(cmTarget&);
101 bool CheckTargetLinks(cmTarget& target, const char* name);
102 std::string GetUtilityForTarget(cmTarget& target, const char*);
103 virtual std::string WriteUtilityDepend(cmTarget*) = 0;
104 std::string GetUtilityDepend(cmTarget* target);
105 typedef std::map<cmTarget*, cmStdString> UtilityDependsMap;
106 UtilityDependsMap UtilityDepends;
107 const char* AdditionalPlatformDefinition;
110 void ComputeTargetObjects(cmGeneratorTarget* gt) const;
112 void FollowLinkDepends(cmTarget* target, std::set<cmTarget*>& linked);
114 class TargetSetMap: public std::map<cmTarget*, TargetSet> {};
115 TargetSetMap TargetLinkClosure;
116 void FillLinkClosure(cmTarget* target, TargetSet& linked);
117 TargetSet const& GetTargetLinkClosure(cmTarget* target);
120 class cmGlobalVisualStudioGenerator::OrderedTargetDependSet:
121 public std::multiset<cmTargetDepend,
122 cmGlobalVisualStudioGenerator::TargetCompare>
125 typedef cmGlobalGenerator::TargetDependSet TargetDependSet;
126 typedef cmGlobalVisualStudioGenerator::TargetSet TargetSet;
127 OrderedTargetDependSet(TargetDependSet const&);
128 OrderedTargetDependSet(TargetSet const&);