1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmExtraEclipseCDT4Generator.h,v $
6 Date: $Date: 2009-03-13 20:52:58 $
7 Version: $Revision: 1.9 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 Copyright (c) 2004 Alexander Neundorf, neundorf@kde.org. All rights reserved.
11 Copyright (c) 2007 Miguel A. Figueroa-Villanueva. All rights reserved.
12 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
14 This software is distributed WITHOUT ANY WARRANTY; without even
15 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 PURPOSE. See the above copyright notices for more information.
18 =========================================================================*/
19 #ifndef cmExtraEclipseCDT4Generator_h
20 #define cmExtraEclipseCDT4Generator_h
22 #include "cmExternalMakefileProjectGenerator.h"
25 class cmGeneratedFileStream
;
27 /** \class cmExtraEclipseCDT4Generator
28 * \brief Write Eclipse project files for Makefile based projects
30 * This generator is in early alpha stage.
32 class cmExtraEclipseCDT4Generator
: public cmExternalMakefileProjectGenerator
35 cmExtraEclipseCDT4Generator();
37 static cmExternalMakefileProjectGenerator
* New() {
38 return new cmExtraEclipseCDT4Generator
;
41 virtual const char* GetName() const {
42 return cmExtraEclipseCDT4Generator::GetActualName();
45 static const char* GetActualName() { return "Eclipse CDT4"; }
47 virtual void GetDocumentation(cmDocumentationEntry
& entry
,
48 const char* fullName
) const;
50 virtual void SetGlobalGenerator(cmGlobalGenerator
* generator
);
52 virtual void Generate();
55 // create .project file in the source tree
56 void CreateSourceProjectFile() const;
58 // create .project file
59 void CreateProjectFile();
61 // create .cproject file
62 void CreateCProjectFile() const;
64 // Eclipse supported toolchain types
65 enum EclipseToolchainType
67 EclipseToolchainOther
,
68 EclipseToolchainLinux
,
69 EclipseToolchainCygwin
,
70 EclipseToolchainMinGW
,
71 EclipseToolchainSolaris
,
72 EclipseToolchainMacOSX
74 static EclipseToolchainType
GetToolChainType(const cmMakefile
& makefile
);
76 // If built with cygwin cmake, convert posix to windows path.
77 static std::string
GetEclipsePath(const std::string
& path
);
80 static std::string
GetPathBasename(const std::string
& path
);
82 // Generate the project name as: <name>-<type>@<path>
83 static std::string
GenerateProjectName(const std::string
& name
,
84 const std::string
& type
,
85 const std::string
& path
);
87 static std::string
EscapeForXML(const std::string
& value
);
90 static void AppendStorageScanners(cmGeneratedFileStream
& fout
,
91 const cmMakefile
& makefile
);
92 static void AppendTarget (cmGeneratedFileStream
& fout
,
93 const std::string
& target
,
94 const std::string
& make
);
95 static void AppendScannerProfile (cmGeneratedFileStream
& fout
,
96 const std::string
& profileID
,
97 bool openActionEnabled
,
98 const std::string
& openActionFilePath
,
100 const std::string
& scannerInfoProviderID
,
101 const std::string
& runActionArguments
,
102 const std::string
& runActionCommand
,
103 bool runActionUseDefault
,
104 bool sipParserEnabled
);
106 static void AppendLinkedResource (cmGeneratedFileStream
& fout
,
107 const std::string
& name
,
108 const std::string
& path
);
110 bool AppendOutLinkedResource(cmGeneratedFileStream
& fout
,
111 const std::string
& defname
,
112 const std::string
& altdefname
);
114 static void AppendIncludeDirectories(cmGeneratedFileStream
& fout
,
115 const std::vector
<std::string
>& includeDirs
,
116 std::set
<std::string
>& emittedDirs
);
118 std::vector
<std::string
> SrcLinkedResources
;
119 std::vector
<std::string
> OutLinkedResources
;
120 std::string HomeDirectory
;
121 std::string HomeOutputDirectory
;
122 std::set
<std::string
> TargetsToIgnore
;
123 bool IsOutOfSourceBuild
;
124 bool GenerateSourceProject
;