1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2004-2009 Kitware, Inc.
4 Copyright 2004 Alexander Neundorf (neundorf@kde.org)
5 Copyright 2007 Miguel A. Figueroa-Villanueva
7 Distributed under the OSI-approved BSD License (the "License");
8 see accompanying file Copyright.txt for details.
10 This software is distributed WITHOUT ANY WARRANTY; without even the
11 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 See the License for more information.
13 ============================================================================*/
14 #ifndef cmExtraEclipseCDT4Generator_h
15 #define cmExtraEclipseCDT4Generator_h
17 #include "cmExternalMakefileProjectGenerator.h"
20 class cmGeneratedFileStream;
22 /** \class cmExtraEclipseCDT4Generator
23 * \brief Write Eclipse project files for Makefile based projects
25 class cmExtraEclipseCDT4Generator : public cmExternalMakefileProjectGenerator
28 enum LinkType {VirtualFolder, LinkToFolder, LinkToFile };
30 cmExtraEclipseCDT4Generator();
32 static cmExternalMakefileProjectGenerator* New() {
33 return new cmExtraEclipseCDT4Generator;
36 virtual const char* GetName() const {
37 return cmExtraEclipseCDT4Generator::GetActualName();
40 static const char* GetActualName() { return "Eclipse CDT4"; }
42 virtual void GetDocumentation(cmDocumentationEntry& entry,
43 const char* fullName) const;
45 virtual void Generate();
48 // create .project file in the source tree
49 void CreateSourceProjectFile();
51 // create .project file
52 void CreateProjectFile();
54 // create .cproject file
55 void CreateCProjectFile() const;
57 // If built with cygwin cmake, convert posix to windows path.
58 static std::string GetEclipsePath(const std::string& path);
61 static std::string GetPathBasename(const std::string& path);
63 // Generate the project name as: <name>-<type>@<path>
64 static std::string GenerateProjectName(const std::string& name,
65 const std::string& type,
66 const std::string& path);
68 static std::string EscapeForXML(const std::string& value);
71 static void AppendStorageScanners(cmGeneratedFileStream& fout,
72 const cmMakefile& makefile);
73 static void AppendTarget (cmGeneratedFileStream& fout,
74 const std::string& target,
75 const std::string& make,
76 const std::string& makeArguments,
77 const std::string& path,
78 const char* prefix = "",
79 const char* makeTarget = NULL);
80 static void AppendScannerProfile (cmGeneratedFileStream& fout,
81 const std::string& profileID,
82 bool openActionEnabled,
83 const std::string& openActionFilePath,
85 const std::string& scannerInfoProviderID,
86 const std::string& runActionArguments,
87 const std::string& runActionCommand,
88 bool runActionUseDefault,
89 bool sipParserEnabled);
91 static void AppendLinkedResource (cmGeneratedFileStream& fout,
92 const std::string& name,
93 const std::string& path,
96 bool AppendOutLinkedResource(cmGeneratedFileStream& fout,
97 const std::string& defname,
98 const std::string& altdefname);
100 static void AppendIncludeDirectories(cmGeneratedFileStream& fout,
101 const std::vector<std::string>& includeDirs,
102 std::set<std::string>& emittedDirs);
104 static void AddEnvVar(cmGeneratedFileStream& fout, const char* envVar,
107 void CreateLinksToSubprojects(cmGeneratedFileStream& fout,
108 const std::string& baseDir);
109 void CreateLinksForTargets(cmGeneratedFileStream& fout);
111 std::vector<std::string> SrcLinkedResources;
112 std::vector<std::string> OutLinkedResources;
113 std::string HomeDirectory;
114 std::string HomeOutputDirectory;
115 bool IsOutOfSourceBuild;
116 bool GenerateSourceProject;
117 bool SupportsVirtualFolders;