Add policy CMP0035 to disallow variable_requires
This commit is contained in:
parent
178b9af186
commit
3969bb23aa
|
@ -1,7 +1,9 @@
|
||||||
variable_requires
|
variable_requires
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
Deprecated. Use the if() command instead.
|
Disallowed. See CMake Policy :policy:`CMP0035`.
|
||||||
|
|
||||||
|
Use the if() command instead.
|
||||||
|
|
||||||
Assert satisfaction of an option's required variables.
|
Assert satisfaction of an option's required variables.
|
||||||
|
|
||||||
|
|
|
@ -64,3 +64,4 @@ All Policies
|
||||||
/policy/CMP0032
|
/policy/CMP0032
|
||||||
/policy/CMP0033
|
/policy/CMP0033
|
||||||
/policy/CMP0034
|
/policy/CMP0034
|
||||||
|
/policy/CMP0035
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
CMP0035
|
||||||
|
-------
|
||||||
|
|
||||||
|
The :command:`variable_requires` command should not be called.
|
||||||
|
|
||||||
|
This command was introduced in November 2001 to perform some conditional
|
||||||
|
logic. It has long been replaced by the :command:`if` command.
|
||||||
|
|
||||||
|
.. |disallowed_version| replace:: 3.0.0
|
||||||
|
.. include:: DISALLOWED_COMMAND.txt
|
|
@ -276,6 +276,11 @@ cmPolicies::cmPolicies()
|
||||||
CMP0034, "CMP0034",
|
CMP0034, "CMP0034",
|
||||||
"The utility_source command should not be called.",
|
"The utility_source command should not be called.",
|
||||||
3,0,0,0, cmPolicies::WARN);
|
3,0,0,0, cmPolicies::WARN);
|
||||||
|
|
||||||
|
this->DefinePolicy(
|
||||||
|
CMP0035, "CMP0035",
|
||||||
|
"The variable_requires command should not be called.",
|
||||||
|
3,0,0,0, cmPolicies::WARN);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmPolicies::~cmPolicies()
|
cmPolicies::~cmPolicies()
|
||||||
|
|
|
@ -86,6 +86,7 @@ public:
|
||||||
CMP0032, ///< Disallow command: output_required_files
|
CMP0032, ///< Disallow command: output_required_files
|
||||||
CMP0033, ///< Disallow command: export_library_dependencies
|
CMP0033, ///< Disallow command: export_library_dependencies
|
||||||
CMP0034, ///< Disallow command: utility_source
|
CMP0034, ///< Disallow command: utility_source
|
||||||
|
CMP0035, ///< Disallow command: variable_requires
|
||||||
|
|
||||||
/** \brief Always the last entry.
|
/** \brief Always the last entry.
|
||||||
*
|
*
|
||||||
|
|
|
@ -16,6 +16,9 @@
|
||||||
bool cmVariableRequiresCommand
|
bool cmVariableRequiresCommand
|
||||||
::InitialPass(std::vector<std::string>const& args, cmExecutionStatus &)
|
::InitialPass(std::vector<std::string>const& args, cmExecutionStatus &)
|
||||||
{
|
{
|
||||||
|
if(this->Disallowed(cmPolicies::CMP0035,
|
||||||
|
"The variable_requires command should not be called; see CMP0035."))
|
||||||
|
{ return true; }
|
||||||
if(args.size() < 3 )
|
if(args.size() < 3 )
|
||||||
{
|
{
|
||||||
this->SetError("called with incorrect number of arguments");
|
this->SetError("called with incorrect number of arguments");
|
||||||
|
|
|
@ -14,40 +14,15 @@
|
||||||
|
|
||||||
#include "cmCommand.h"
|
#include "cmCommand.h"
|
||||||
|
|
||||||
/** \class cmVariableRequiresCommand
|
|
||||||
* \brief Displays a message to the user
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class cmVariableRequiresCommand : public cmCommand
|
class cmVariableRequiresCommand : public cmCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
cmTypeMacro(cmVariableRequiresCommand, cmCommand);
|
||||||
* This is a virtual constructor for the command.
|
virtual cmCommand* Clone() { return new cmVariableRequiresCommand; }
|
||||||
*/
|
|
||||||
virtual cmCommand* Clone()
|
|
||||||
{
|
|
||||||
return new cmVariableRequiresCommand;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is called when the command is first encountered in
|
|
||||||
* the CMakeLists.txt file.
|
|
||||||
*/
|
|
||||||
virtual bool InitialPass(std::vector<std::string> const& args,
|
virtual bool InitialPass(std::vector<std::string> const& args,
|
||||||
cmExecutionStatus &status);
|
cmExecutionStatus &status);
|
||||||
|
|
||||||
/**
|
|
||||||
* The name of the command as specified in CMakeList.txt.
|
|
||||||
*/
|
|
||||||
virtual const char* GetName() const { return "variable_requires";}
|
virtual const char* GetName() const { return "variable_requires";}
|
||||||
|
virtual bool IsDiscouraged() const { return true; }
|
||||||
/** This command is kept for compatibility with older CMake versions. */
|
|
||||||
virtual bool IsDiscouraged() const
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
cmTypeMacro(cmVariableRequiresCommand, cmCommand);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -0,0 +1,4 @@
|
||||||
|
CMake Error at CMP0035-NEW.cmake:2 \(variable_requires\):
|
||||||
|
The variable_requires command should not be called; see CMP0035.
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1,2 @@
|
||||||
|
cmake_policy(SET CMP0035 NEW)
|
||||||
|
variable_requires()
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -0,0 +1,4 @@
|
||||||
|
CMake Error at CMP0035-OLD.cmake:2 \(variable_requires\):
|
||||||
|
variable_requires called with incorrect number of arguments
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1,2 @@
|
||||||
|
cmake_policy(SET CMP0035 OLD)
|
||||||
|
variable_requires()
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -0,0 +1,12 @@
|
||||||
|
CMake Warning \(dev\) at CMP0035-WARN.cmake:1 \(variable_requires\):
|
||||||
|
Policy CMP0035 is not set: The variable_requires command should not be
|
||||||
|
called. Run "cmake --help-policy CMP0035" for policy details. Use the
|
||||||
|
cmake_policy command to set the policy and suppress this warning.
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||||
|
|
||||||
|
CMake Error at CMP0035-WARN.cmake:1 \(variable_requires\):
|
||||||
|
variable_requires called with incorrect number of arguments
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1 @@
|
||||||
|
variable_requires()
|
|
@ -7,6 +7,7 @@ foreach(p
|
||||||
CMP0032
|
CMP0032
|
||||||
CMP0033
|
CMP0033
|
||||||
CMP0034
|
CMP0034
|
||||||
|
CMP0035
|
||||||
)
|
)
|
||||||
run_cmake(${p}-WARN)
|
run_cmake(${p}-WARN)
|
||||||
run_cmake(${p}-OLD)
|
run_cmake(${p}-OLD)
|
||||||
|
|
Loading…
Reference in New Issue