1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
5 #include "cmConfigure.h" // IWYU pragma: keep
12 #include "cmExternalMakefileProjectGenerator.h"
14 class cmLocalGenerator
;
19 /** \class cmExtraEclipseCDT4Generator
20 * \brief Write Eclipse project files for Makefile based projects
22 class cmExtraEclipseCDT4Generator
: public cmExternalMakefileProjectGenerator
32 cmExtraEclipseCDT4Generator();
34 static cmExternalMakefileProjectGeneratorFactory
* GetFactory();
36 void EnableLanguage(std::vector
<std::string
> const& languages
, cmMakefile
*,
37 bool optional
) override
;
39 void Generate() override
;
42 // create .project file in the source tree
43 void CreateSourceProjectFile();
45 // create .settings/org.eclipse.core.resources.prefs
46 void CreateSettingsResourcePrefsFile();
48 // create .project file
49 void CreateProjectFile();
51 // create .cproject file
52 void CreateCProjectFile() const;
54 // If built with cygwin cmake, convert posix to windows path.
55 static std::string
GetEclipsePath(const std::string
& path
);
58 static std::string
GetPathBasename(const std::string
& path
);
60 // Generate the project name as: <name>-<type>@<path>
61 static std::string
GenerateProjectName(const std::string
& name
,
62 const std::string
& type
,
63 const std::string
& path
);
66 static void AppendStorageScanners(cmXMLWriter
& xml
,
67 const cmMakefile
& makefile
);
68 static void AppendTarget(cmXMLWriter
& xml
, const std::string
& target
,
69 const std::string
& make
,
70 const std::string
& makeArguments
,
71 const std::string
& path
, const char* prefix
= "",
72 const char* makeTarget
= nullptr);
73 static void AppendScannerProfile(
74 cmXMLWriter
& xml
, const std::string
& profileID
, bool openActionEnabled
,
75 const std::string
& openActionFilePath
, bool pParserEnabled
,
76 const std::string
& scannerInfoProviderID
,
77 const std::string
& runActionArguments
, const std::string
& runActionCommand
,
78 bool runActionUseDefault
, bool sipParserEnabled
);
80 static void AppendLinkedResource(cmXMLWriter
& xml
, const std::string
& name
,
81 const std::string
& path
, LinkType linkType
);
83 static void AppendIncludeDirectories(
84 cmXMLWriter
& xml
, const std::vector
<std::string
>& includeDirs
,
85 std::set
<std::string
>& emittedDirs
);
87 static void AddEnvVar(std::ostream
& out
, const char* envVar
,
88 cmLocalGenerator
& lg
);
90 void WriteGroups(std::vector
<cmSourceGroup
> const& sourceGroups
,
91 std::string
& linkName
, cmXMLWriter
& xml
);
92 void CreateLinksToSubprojects(cmXMLWriter
& xml
, const std::string
& baseDir
);
93 void CreateLinksForTargets(cmXMLWriter
& xml
);
95 std::vector
<std::string
> SrcLinkedResources
;
96 std::set
<std::string
> Natures
;
97 std::string HomeDirectory
;
98 std::string HomeOutputDirectory
;
99 bool IsOutOfSourceBuild
;
100 bool GenerateSourceProject
;
101 bool GenerateLinkedResources
;
102 bool SupportsVirtualFolders
;
103 bool SupportsGmakeErrorParser
;
104 bool SupportsMachO64Parser
;