CMake Nightly Date Stamp
[kiteware-cmake.git] / Source / cmExtraEclipseCDT4Generator.h
blobc4ed577b33dc66fd52a119614a42e6aff31cad93
1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
3 #pragma once
5 #include "cmConfigure.h" // IWYU pragma: keep
7 #include <iosfwd>
8 #include <set>
9 #include <string>
10 #include <vector>
12 #include "cmExternalMakefileProjectGenerator.h"
14 class cmLocalGenerator;
15 class cmMakefile;
16 class cmSourceGroup;
17 class cmXMLWriter;
19 /** \class cmExtraEclipseCDT4Generator
20 * \brief Write Eclipse project files for Makefile based projects
22 class cmExtraEclipseCDT4Generator : public cmExternalMakefileProjectGenerator
24 public:
25 enum LinkType
27 VirtualFolder,
28 LinkToFolder,
29 LinkToFile
32 cmExtraEclipseCDT4Generator();
34 static cmExternalMakefileProjectGeneratorFactory* GetFactory();
36 void EnableLanguage(std::vector<std::string> const& languages, cmMakefile*,
37 bool optional) override;
39 void Generate() override;
41 private:
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);
57 // Extract basename.
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);
65 // Helper functions
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;
105 bool CEnabled;
106 bool CXXEnabled;