1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmLocalVisualStudio7Generator.h,v $
6 Date: $Date: 2008-04-30 17:26:03 $
7 Version: $Revision: 1.51 $
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.
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.
16 =========================================================================*/
17 #ifndef cmLocalVisualStudio7Generator_h
18 #define cmLocalVisualStudio7Generator_h
20 #include "cmLocalVisualStudioGenerator.h"
24 class cmCustomCommand
;
26 struct cmVS7FlagTable
;
28 class cmLocalVisualStudio7GeneratorOptions
;
29 class cmLocalVisualStudio7GeneratorFCInfo
;
30 class cmLocalVisualStudio7GeneratorInternals
;
32 /** \class cmLocalVisualStudio7Generator
33 * \brief Write Visual Studio .NET project files.
35 * cmLocalVisualStudio7Generator produces a Visual Studio .NET project
36 * file for each target in its directory.
38 class cmLocalVisualStudio7Generator
: public cmLocalVisualStudioGenerator
41 ///! Set cache only and recurse to false by default.
42 cmLocalVisualStudio7Generator();
44 virtual ~cmLocalVisualStudio7Generator();
46 virtual void AddHelperCommands();
49 * Generate the makefile for this directory.
51 virtual void Generate();
53 enum BuildType
{STATIC_LIBRARY
, DLL
, EXECUTABLE
, WIN32_EXECUTABLE
, UTILITY
};
56 * Specify the type of the build: static, dll, or executable.
58 void SetBuildType(BuildType
,const char *name
);
60 void SetVersion71() {this->Version
= 71;}
61 void SetVersion8() {this->Version
= 8;}
62 void SetVersion9() {this->Version
= 9;}
63 void SetPlatformName(const char* n
) { this->PlatformName
= n
;}
64 virtual void ConfigureFinalPass();
65 void GetTargetObjectFileDirectories(cmTarget
* target
,
66 std::vector
<std::string
>&
69 void SetExtraFlagTable(cmVS7FlagTable
const* table
)
70 { this->ExtraFlagTable
= table
; }
72 typedef cmLocalVisualStudio7GeneratorOptions Options
;
73 typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo
;
74 void ReadAndStoreExternalGUID(const char* name
,
76 std::string
GetBuildTypeLinkerFlags(std::string rootLinkerFlags
,
77 const char* configName
);
78 void FixGlobalTargets();
79 void WriteProjectFiles();
80 void WriteStampFiles();
81 void WriteVCProjHeader(std::ostream
& fout
, const char *libName
,
82 cmTarget
&tgt
, std::vector
<cmSourceGroup
> &sgs
);
83 void WriteVCProjFooter(std::ostream
& fout
);
84 void CreateSingleVCProj(const char *lname
, cmTarget
&tgt
);
85 void WriteVCProjFile(std::ostream
& fout
, const char *libName
,
87 cmSourceFile
* CreateVCProjBuildRule();
88 void WriteConfigurations(std::ostream
& fout
,
89 const char *libName
, cmTarget
&tgt
);
90 void WriteConfiguration(std::ostream
& fout
,
91 const char* configName
,
92 const char* libName
, cmTarget
&tgt
);
93 std::string
EscapeForXML(const char* s
);
94 std::string
ConvertToXMLOutputPath(const char* path
);
95 std::string
ConvertToXMLOutputPathSingle(const char* path
);
96 void OutputTargetRules(std::ostream
& fout
, const char* configName
,
97 cmTarget
&target
, const char *libName
);
98 void OutputBuildTool(std::ostream
& fout
, const char* configName
,
99 cmTarget
& t
, bool debug
);
100 void OutputLibraryDirectories(std::ostream
& fout
,
101 std::vector
<std::string
> const& dirs
);
102 void OutputModuleDefinitionFile(std::ostream
& fout
, cmTarget
&target
);
103 void WriteProjectStart(std::ostream
& fout
, const char *libName
,
104 cmTarget
&tgt
, std::vector
<cmSourceGroup
> &sgs
);
105 void WriteProjectStartFortran(std::ostream
& fout
, const char *libName
,
107 void WriteVCProjBeginGroup(std::ostream
& fout
,
110 void WriteVCProjEndGroup(std::ostream
& fout
);
112 void WriteCustomRule(std::ostream
& fout
,
114 const cmCustomCommand
& command
,
116 void WriteTargetVersionAttribute(std::ostream
& fout
, cmTarget
& target
);
118 void WriteGroup(const cmSourceGroup
*sg
,
119 cmTarget
& target
, std::ostream
&fout
,
120 const char *libName
, std::vector
<std::string
> *configs
);
121 virtual std::string
GetTargetDirectory(cmTarget
const&) const;
123 friend class cmLocalVisualStudio7GeneratorFCInfo
;
124 friend class cmLocalVisualStudio7GeneratorInternals
;
126 cmVS7FlagTable
const* ExtraFlagTable
;
127 std::string ModuleDefinitionFile
;
130 std::string PlatformName
; // Win32 or x64
131 cmLocalVisualStudio7GeneratorInternals
* Internal
;
134 // This is a table mapping XML tag IDE names to command line options
135 struct cmVS7FlagTable
137 const char* IDEName
; // name used in the IDE xml file
138 const char* commandFlag
; // command line flag
139 const char* comment
; // comment
140 const char* value
; // string value
141 unsigned int special
; // flags for special handling requests
144 UserValue
= (1<<0), // flag contains a user-specified value
145 UserIgnored
= (1<<1), // ignore any user value
146 UserRequired
= (1<<2), // match only when user value is non-empty
147 Continue
= (1<<3), // continue looking for matching entries
148 SemicolonAppendable
= (1<<4), // a flag that if specified multiple times
149 // should have its value appended to the
150 // old value with semicolons (e.g.
152 // IgnoreDefaultLibraryNames)
154 UserValueIgnored
= UserValue
| UserIgnored
,
155 UserValueRequired
= UserValue
| UserRequired