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
11 #include "cmExternalMakefileProjectGenerator.h"
13 class cmGeneratedFileStream;
14 class cmGeneratorTarget;
15 class cmLocalGenerator;
19 /** \class cmExtraSublimeTextGenerator
20 * \brief Write Sublime Text 2 project files for Makefile based projects
22 class cmExtraSublimeTextGenerator : public cmExternalMakefileProjectGenerator
25 static cmExternalMakefileProjectGeneratorFactory* GetFactory();
26 using MapSourceFileFlags = std::map<std::string, std::vector<std::string>>;
27 cmExtraSublimeTextGenerator();
29 void Generate() override;
32 void CreateProjectFile(const std::vector<cmLocalGenerator*>& lgs);
34 void CreateNewProjectFile(const std::vector<cmLocalGenerator*>& lgs,
35 const std::string& filename);
37 /** Appends all targets as build systems to the project file and get all
38 * include directories and compiler definitions used.
40 void AppendAllTargets(const std::vector<cmLocalGenerator*>& lgs,
41 const cmMakefile* mf, cmGeneratedFileStream& fout,
42 MapSourceFileFlags& sourceFileFlags);
43 /** Returns the build command that needs to be executed to build the
46 std::string BuildMakeCommand(const std::string& make,
47 const std::string& makefile,
48 const std::string& target);
49 /** Appends the specified target to the generated project file as a Sublime
52 void AppendTarget(cmGeneratedFileStream& fout, const std::string& targetName,
53 cmLocalGenerator* lg, cmGeneratorTarget* target,
54 const char* make, const cmMakefile* makefile,
55 const char* compiler, MapSourceFileFlags& sourceFileFlags,
58 * Compute the flags for compilation of object files for a given @a language.
59 * @note Generally it is the value of the variable whose name is computed
60 * by LanguageFlagsVarName().
62 std::string ComputeFlagsForObject(cmSourceFile* source, cmLocalGenerator* lg,
63 cmGeneratorTarget* gtgt);
65 std::string ComputeDefines(cmSourceFile* source, cmLocalGenerator* lg,
66 cmGeneratorTarget* gtgt);
68 std::string ComputeIncludes(cmSourceFile* source, cmLocalGenerator* lg,
69 cmGeneratorTarget* gtgt);
71 bool Open(const std::string& bindir, const std::string& projectName,
72 bool dryRun) override;
74 bool ExcludeBuildFolder;
75 std::string EnvSettings;