1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmExtraEclipseCDT4Generator.h,v $
6 Date: $Date: 2009-09-16 22:01:22 $
7 Version: $Revision: 1.11 $
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 const std::string
& path
,
96 const char* prefix
= "");
97 static void AppendScannerProfile (cmGeneratedFileStream
& fout
,
98 const std::string
& profileID
,
99 bool openActionEnabled
,
100 const std::string
& openActionFilePath
,
102 const std::string
& scannerInfoProviderID
,
103 const std::string
& runActionArguments
,
104 const std::string
& runActionCommand
,
105 bool runActionUseDefault
,
106 bool sipParserEnabled
);
108 static void AppendLinkedResource (cmGeneratedFileStream
& fout
,
109 const std::string
& name
,
110 const std::string
& path
);
112 bool AppendOutLinkedResource(cmGeneratedFileStream
& fout
,
113 const std::string
& defname
,
114 const std::string
& altdefname
);
116 static void AppendIncludeDirectories(cmGeneratedFileStream
& fout
,
117 const std::vector
<std::string
>& includeDirs
,
118 std::set
<std::string
>& emittedDirs
);
120 std::vector
<std::string
> SrcLinkedResources
;
121 std::vector
<std::string
> OutLinkedResources
;
122 std::string HomeDirectory
;
123 std::string HomeOutputDirectory
;
124 bool IsOutOfSourceBuild
;
125 bool GenerateSourceProject
;