mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-22 06:09:14 -05:00
cmGeneratorTarget: add a method to build classified command lines
This is essentially an extraction of the `Ninja` generator's command line building logic. Porting generators to reuse this construction is a task for the future.
This commit is contained in:
@@ -517,6 +517,64 @@ public:
|
||||
std::vector<std::string> GetAppleArchs(std::string const& config,
|
||||
cm::optional<std::string> lang) const;
|
||||
|
||||
// The classification of the flag.
|
||||
enum class FlagClassification
|
||||
{
|
||||
// The flag is for the execution of the tool (e.g., the compiler itself,
|
||||
// any launchers, etc.).
|
||||
ExecutionFlag,
|
||||
// The flag is "baseline" and should be apply to TUs which may interact
|
||||
// with this compilation (e.g., imported modules).
|
||||
BaselineFlag,
|
||||
// The flag is "private" and doesn't need to apply to interacting TUs.
|
||||
PrivateFlag,
|
||||
// Flags for the TU itself (e.g., output paths, dependency scanning, etc.).
|
||||
LocationFlag,
|
||||
};
|
||||
enum class FlagKind
|
||||
{
|
||||
// Not a flag (executable or other entries).
|
||||
NotAFlag,
|
||||
// Flags for support of the build system.
|
||||
BuildSystem,
|
||||
// A compilation flag.
|
||||
Compile,
|
||||
// An include flag.
|
||||
Include,
|
||||
// A compile definition.
|
||||
Definition,
|
||||
};
|
||||
struct ClassifiedFlag
|
||||
{
|
||||
ClassifiedFlag(FlagClassification cls, FlagKind kind, std::string flag)
|
||||
: Classification(cls)
|
||||
, Kind(kind)
|
||||
, Flag(std::move(flag))
|
||||
{
|
||||
}
|
||||
|
||||
FlagClassification Classification;
|
||||
FlagKind Kind;
|
||||
std::string Flag;
|
||||
};
|
||||
using ClassifiedFlags = std::vector<ClassifiedFlag>;
|
||||
ClassifiedFlags GetClassifiedFlagsForSource(cmSourceFile const* sf,
|
||||
std::string const& config);
|
||||
struct SourceVariables
|
||||
{
|
||||
std::string TargetPDB;
|
||||
std::string TargetCompilePDB;
|
||||
std::string ObjectDir;
|
||||
std::string ObjectFileDir;
|
||||
std::string DependencyFile;
|
||||
std::string DependencyTarget;
|
||||
|
||||
// Dependency flags (if used)
|
||||
std::string DependencyFlags;
|
||||
};
|
||||
SourceVariables GetSourceVariables(cmSourceFile const* sf,
|
||||
std::string const& config);
|
||||
|
||||
void AddExplicitLanguageFlags(std::string& flags,
|
||||
cmSourceFile const& sf) const;
|
||||
|
||||
@@ -1452,6 +1510,7 @@ private:
|
||||
std::map<std::string, cmFileSet const*> FileSetCache;
|
||||
std::map<cmGeneratorTarget const*, std::vector<cmGeneratorTarget const*>>
|
||||
SyntheticDeps;
|
||||
std::map<cmSourceFile const*, ClassifiedFlags> SourceFlags;
|
||||
};
|
||||
mutable std::map<std::string, InfoByConfig> Configs;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user