cmake/Source/cmCustomCommand.h

127 lines
4.1 KiB
C
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
2021-09-14 00:13:48 +02:00
#pragma once
2017-07-20 19:35:53 +02:00
#include "cmConfigure.h" // IWYU pragma: keep
2016-07-09 11:21:54 +02:00
2016-10-30 18:24:19 +01:00
#include <string>
#include <utility>
#include <vector>
2020-02-01 23:06:01 +01:00
#include "cmCustomCommandLines.h"
#include "cmListFileCache.h"
2021-09-14 00:13:48 +02:00
#include "cmPolicies.h"
2020-02-01 23:06:01 +01:00
class cmImplicitDependsList
: public std::vector<std::pair<std::string, std::string>>
{
};
/** \class cmCustomCommand
* \brief A class to encapsulate a custom command
*
* cmCustomCommand encapsulates the properties of a custom command
*/
class cmCustomCommand
{
public:
/** Main constructor specifies all information for the command. */
2020-08-30 11:54:41 +02:00
cmCustomCommand(std::vector<std::string> outputs,
2019-11-11 23:01:05 +01:00
std::vector<std::string> byproducts,
std::vector<std::string> depends,
2020-08-30 11:54:41 +02:00
cmCustomCommandLines commandLines, cmListFileBacktrace lfbt,
const char* comment, const char* workingDirectory,
bool stdPipesUTF8);
/** Get the output file produced by the command. */
const std::vector<std::string>& GetOutputs() const;
2015-04-27 22:25:09 +02:00
/** Get the extra files produced by the command. */
const std::vector<std::string>& GetByproducts() const;
/** Get the vector that holds the list of dependencies. */
const std::vector<std::string>& GetDepends() const;
2015-04-27 22:25:09 +02:00
/** Get the working directory. */
std::string const& GetWorkingDirectory() const
2016-07-09 11:21:54 +02:00
{
return this->WorkingDirectory;
}
2015-04-27 22:25:09 +02:00
/** Get the list of command lines. */
const cmCustomCommandLines& GetCommandLines() const;
/** Get the comment string for the command. */
const char* GetComment() const;
2020-08-30 11:54:41 +02:00
/** Get a value indicating if the command uses UTF-8 output pipes. */
bool GetStdPipesUTF8() const { return this->StdPipesUTF8; }
/** Append to the list of command lines. */
void AppendCommands(const cmCustomCommandLines& commandLines);
/** Append to the list of dependencies. */
void AppendDepends(const std::vector<std::string>& depends);
/** Set/Get whether old-style escaping should be used. */
bool GetEscapeOldStyle() const;
void SetEscapeOldStyle(bool b);
/** Set/Get whether the build tool can replace variables in
arguments to the command. */
bool GetEscapeAllowMakeVars() const;
void SetEscapeAllowMakeVars(bool b);
2011-01-16 11:35:12 +01:00
/** Backtrace of the command that created this custom command. */
cmListFileBacktrace const& GetBacktrace() const;
2020-02-01 23:06:01 +01:00
void SetImplicitDepends(cmImplicitDependsList const&);
void AppendImplicitDepends(cmImplicitDependsList const&);
cmImplicitDependsList const& GetImplicitDepends() const;
2015-04-27 22:25:09 +02:00
/** Set/Get whether this custom command should be given access to the
real console (if possible). */
bool GetUsesTerminal() const;
void SetUsesTerminal(bool b);
2017-04-14 19:02:05 +02:00
/** Set/Get whether lists in command lines should be expanded. */
bool GetCommandExpandLists() const;
void SetCommandExpandLists(bool b);
2016-10-30 18:24:19 +01:00
/** Set/Get the depfile (used by the Ninja generator) */
const std::string& GetDepfile() const;
void SetDepfile(const std::string& depfile);
2019-11-11 23:01:05 +01:00
/** Set/Get the job_pool (used by the Ninja generator) */
const std::string& GetJobPool() const;
void SetJobPool(const std::string& job_pool);
2021-09-14 00:13:48 +02:00
/** Set/Get the CMP0116 status (used by the Ninja generator) */
cmPolicies::PolicyStatus GetCMP0116Status() const;
void SetCMP0116Status(cmPolicies::PolicyStatus cmp0116);
/** Set/Get the associated target */
const std::string& GetTarget() const;
void SetTarget(const std::string& target);
private:
std::vector<std::string> Outputs;
2015-04-27 22:25:09 +02:00
std::vector<std::string> Byproducts;
std::vector<std::string> Depends;
cmCustomCommandLines CommandLines;
2015-11-17 17:22:37 +01:00
cmListFileBacktrace Backtrace;
2020-02-01 23:06:01 +01:00
cmImplicitDependsList ImplicitDepends;
2021-09-14 00:13:48 +02:00
std::string Target;
std::string Comment;
std::string WorkingDirectory;
2016-10-30 18:24:19 +01:00
std::string Depfile;
2019-11-11 23:01:05 +01:00
std::string JobPool;
bool HaveComment = false;
bool EscapeAllowMakeVars = false;
bool EscapeOldStyle = true;
bool UsesTerminal = false;
bool CommandExpandLists = false;
2020-08-30 11:54:41 +02:00
bool StdPipesUTF8 = false;
2021-09-14 00:13:48 +02:00
cmPolicies::PolicyStatus CMP0116Status = cmPolicies::WARN;
};