Add policy CMP0034 to disallow utility_source
This commit is contained in:
parent
248d1dc057
commit
178b9af186
|
@ -1,6 +1,8 @@
|
||||||
utility_source
|
utility_source
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
Disallowed. See CMake Policy :policy:`CMP0034`.
|
||||||
|
|
||||||
Specify the source tree of a third-party utility.
|
Specify the source tree of a third-party utility.
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
|
@ -63,3 +63,4 @@ All Policies
|
||||||
/policy/CMP0031
|
/policy/CMP0031
|
||||||
/policy/CMP0032
|
/policy/CMP0032
|
||||||
/policy/CMP0033
|
/policy/CMP0033
|
||||||
|
/policy/CMP0034
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
CMP0034
|
||||||
|
-------
|
||||||
|
|
||||||
|
The :command:`utility_source` command should not be called.
|
||||||
|
|
||||||
|
This command was introduced in March 2001 to help build executables used to
|
||||||
|
generate other files. This approach has long been replaced by
|
||||||
|
:command:`add_executable` combined with :command:`add_custom_command`.
|
||||||
|
|
||||||
|
.. |disallowed_version| replace:: 3.0.0
|
||||||
|
.. include:: DISALLOWED_COMMAND.txt
|
|
@ -271,6 +271,11 @@ cmPolicies::cmPolicies()
|
||||||
CMP0033, "CMP0033",
|
CMP0033, "CMP0033",
|
||||||
"The export_library_dependencies command should not be called.",
|
"The export_library_dependencies command should not be called.",
|
||||||
3,0,0,0, cmPolicies::WARN);
|
3,0,0,0, cmPolicies::WARN);
|
||||||
|
|
||||||
|
this->DefinePolicy(
|
||||||
|
CMP0034, "CMP0034",
|
||||||
|
"The utility_source command should not be called.",
|
||||||
|
3,0,0,0, cmPolicies::WARN);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmPolicies::~cmPolicies()
|
cmPolicies::~cmPolicies()
|
||||||
|
|
|
@ -85,6 +85,7 @@ public:
|
||||||
CMP0031, ///< Disallow command: load_command
|
CMP0031, ///< Disallow command: load_command
|
||||||
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
|
||||||
|
|
||||||
/** \brief Always the last entry.
|
/** \brief Always the last entry.
|
||||||
*
|
*
|
||||||
|
|
|
@ -15,6 +15,9 @@
|
||||||
bool cmUtilitySourceCommand
|
bool cmUtilitySourceCommand
|
||||||
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
|
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
|
||||||
{
|
{
|
||||||
|
if(this->Disallowed(cmPolicies::CMP0034,
|
||||||
|
"The utility_source command should not be called; see CMP0034."))
|
||||||
|
{ 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,48 +14,15 @@
|
||||||
|
|
||||||
#include "cmCommand.h"
|
#include "cmCommand.h"
|
||||||
|
|
||||||
/** \class cmUtilitySourceCommand
|
|
||||||
* \brief A command to setup a cache entry with the location of a third-party
|
|
||||||
* utility's source.
|
|
||||||
*
|
|
||||||
* cmUtilitySourceCommand is used when a third-party utility's source is
|
|
||||||
* included in the project's source tree. It specifies the location of
|
|
||||||
* the executable's source, and any files that may be needed to confirm the
|
|
||||||
* identity of the source.
|
|
||||||
*/
|
|
||||||
class cmUtilitySourceCommand : public cmCommand
|
class cmUtilitySourceCommand : public cmCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
cmTypeMacro(cmUtilitySourceCommand, cmCommand);
|
||||||
* This is a virtual constructor for the command.
|
virtual cmCommand* Clone() { return new cmUtilitySourceCommand; }
|
||||||
*/
|
|
||||||
virtual cmCommand* Clone()
|
|
||||||
{
|
|
||||||
return new cmUtilitySourceCommand;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 "utility_source";}
|
virtual const char* GetName() const { return "utility_source";}
|
||||||
|
virtual bool IsDiscouraged() const { return true; }
|
||||||
/** This command is kept for compatibility with older CMake versions. */
|
|
||||||
virtual bool IsDiscouraged() const
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
cmTypeMacro(cmUtilitySourceCommand, cmCommand);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -0,0 +1,4 @@
|
||||||
|
CMake Error at CMP0034-NEW.cmake:2 \(utility_source\):
|
||||||
|
The utility_source command should not be called; see CMP0034.
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1,2 @@
|
||||||
|
cmake_policy(SET CMP0034 NEW)
|
||||||
|
utility_source()
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -0,0 +1,4 @@
|
||||||
|
CMake Error at CMP0034-OLD.cmake:2 \(utility_source\):
|
||||||
|
utility_source called with incorrect number of arguments
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1,2 @@
|
||||||
|
cmake_policy(SET CMP0034 OLD)
|
||||||
|
utility_source()
|
|
@ -0,0 +1 @@
|
||||||
|
1
|
|
@ -0,0 +1,12 @@
|
||||||
|
CMake Warning \(dev\) at CMP0034-WARN.cmake:1 \(utility_source\):
|
||||||
|
Policy CMP0034 is not set: The utility_source command should not be called.
|
||||||
|
Run "cmake --help-policy CMP0034" 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 CMP0034-WARN.cmake:1 \(utility_source\):
|
||||||
|
utility_source called with incorrect number of arguments
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMakeLists.txt:3 \(include\)
|
|
@ -0,0 +1 @@
|
||||||
|
utility_source()
|
|
@ -6,6 +6,7 @@ foreach(p
|
||||||
CMP0031
|
CMP0031
|
||||||
CMP0032
|
CMP0032
|
||||||
CMP0033
|
CMP0033
|
||||||
|
CMP0034
|
||||||
)
|
)
|
||||||
run_cmake(${p}-WARN)
|
run_cmake(${p}-WARN)
|
||||||
run_cmake(${p}-OLD)
|
run_cmake(${p}-OLD)
|
||||||
|
|
Loading…
Reference in New Issue