cmake/Source/cmIfCommand.h

73 lines
1.8 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. */
#ifndef cmIfCommand_h
#define cmIfCommand_h
2018-01-26 17:06:56 +01:00
#include "cmConfigure.h" // IWYU pragma: keep
2017-07-20 19:35:53 +02:00
2017-04-14 19:02:05 +02:00
#include <string>
#include <vector>
2016-07-09 11:21:54 +02:00
2017-04-14 19:02:05 +02:00
#include "cmCommand.h"
#include "cmFunctionBlocker.h"
2017-04-14 19:02:05 +02:00
#include "cmListFileCache.h"
class cmExecutionStatus;
class cmExpandedCommandArgument;
class cmMakefile;
class cmIfFunctionBlocker : public cmFunctionBlocker
{
public:
2016-07-09 11:21:54 +02:00
cmIfFunctionBlocker()
{
this->HasRun = false;
2017-07-20 19:35:53 +02:00
this->ElseSeen = false;
2016-07-09 11:21:54 +02:00
this->ScopeDepth = 0;
}
2018-01-26 17:06:56 +01:00
~cmIfFunctionBlocker() override {}
2016-10-30 18:24:19 +01:00
bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf,
2018-01-26 17:06:56 +01:00
cmExecutionStatus&) override;
bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) override;
2013-03-16 19:13:01 +02:00
std::vector<cmListFileArgument> Args;
std::vector<cmListFileFunction> Functions;
bool IsBlocking;
bool HasRun;
2017-07-20 19:35:53 +02:00
bool ElseSeen;
unsigned int ScopeDepth;
};
2012-04-19 19:04:21 +03:00
/// Starts an if block
class cmIfCommand : public cmCommand
{
public:
/**
* This is a virtual constructor for the command.
*/
2018-01-26 17:06:56 +01:00
cmCommand* Clone() override { return new cmIfCommand; }
/**
* This overrides the default InvokeInitialPass implementation.
* It records the arguments before expansion.
*/
2016-10-30 18:24:19 +01:00
bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
2018-01-26 17:06:56 +01:00
cmExecutionStatus&) override;
2013-03-16 19:13:01 +02:00
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
2016-10-30 18:24:19 +01:00
bool InitialPass(std::vector<std::string> const&,
2018-01-26 17:06:56 +01:00
cmExecutionStatus&) override
2016-07-09 11:21:54 +02:00
{
return false;
}
2015-04-27 22:25:09 +02:00
// Filter the given variable definition based on policy CMP0054.
static const char* GetDefinitionIfUnquoted(
const cmMakefile* mf, cmExpandedCommandArgument const& argument);
};
#endif