Add policy CMP0030 to disallow use_mangled_mesa

This commit is contained in:
Brad King 2013-10-18 11:55:42 -04:00
parent 9f64fbf5b5
commit 97268cf5b7
17 changed files with 54 additions and 38 deletions

View File

@ -1,6 +1,8 @@
use_mangled_mesa
----------------
Disallowed. See CMake Policy :policy:`CMP0030`.
Copy mesa headers for use in combination with system GL.
::

View File

@ -59,3 +59,4 @@ All Policies
/policy/CMP0027
/policy/CMP0028
/policy/CMP0029
/policy/CMP0030

11
Help/policy/CMP0030.rst Normal file
View File

@ -0,0 +1,11 @@
CMP0030
-------
The :command:`use_mangled_mesa` command should not be called.
This command was created in September 2001 to support VTK before
modern CMake language and custom command capabilities. VTK has
not used it in years.
.. |disallowed_version| replace:: 3.0.0
.. include:: DISALLOWED_COMMAND.txt

View File

@ -251,6 +251,11 @@ cmPolicies::cmPolicies()
CMP0029, "CMP0029",
"The subdir_depends command should not be called.",
3,0,0,0, cmPolicies::WARN);
this->DefinePolicy(
CMP0030, "CMP0030",
"The use_mangled_mesa command should not be called.",
3,0,0,0, cmPolicies::WARN);
}
cmPolicies::~cmPolicies()

View File

@ -81,6 +81,7 @@ public:
/// directories.
CMP0028, ///< Double colon in target name means ALIAS or IMPORTED target.
CMP0029, ///< Disallow command: subdir_depends
CMP0030, ///< Disallow command: use_mangled_mesa
/** \brief Always the last entry.
*

View File

@ -14,10 +14,12 @@
#include <cmsys/RegularExpression.hxx>
// cmUseMangledMesaCommand
bool cmUseMangledMesaCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
{
if(this->Disallowed(cmPolicies::CMP0030,
"The use_mangled_mesa command should not be called; see CMP0030."))
{ return true; }
// expected two arguments:
// arguement one: the full path to gl_mangle.h
// arguement two : directory for output of edited headers

View File

@ -14,54 +14,19 @@
#include "cmCommand.h"
#include "cmSourceFile.h"
/** \class cmUseMangledMesaCommand
* \brief Create Tcl Wrappers for VTK classes.
*
* cmUseMangledMesaCommand is used to define a CMake variable include
* path location by specifying a file and list of directories.
*/
class cmUseMangledMesaCommand : public cmCommand
{
public:
cmTypeMacro(cmUseMangledMesaCommand, cmCommand);
/**
* This is a virtual constructor for the command.
*/
virtual cmCommand* Clone()
{
return new cmUseMangledMesaCommand;
}
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
virtual cmCommand* Clone() { return new cmUseMangledMesaCommand; }
virtual bool InitialPass(std::vector<std::string> const& args,
cmExecutionStatus &status);
/**
* The name of the command as specified in CMakeList.txt.
*/
virtual const char* GetName() const { return "use_mangled_mesa";}
/**
* This determines if the command is invoked when in script mode.
*/
virtual bool IsScriptable() const { return true; }
/** This command is kept for compatibility with older CMake versions. */
virtual bool IsDiscouraged() const
{
return true;
}
virtual bool IsDiscouraged() const { return true; }
protected:
void CopyAndFullPathMesaHeader(const char* source,
const char* outdir);
};
#endif

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,4 @@
CMake Error at CMP0030-NEW.cmake:2 \(use_mangled_mesa\):
The use_mangled_mesa command should not be called; see CMP0030.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -0,0 +1,2 @@
cmake_policy(SET CMP0030 NEW)
use_mangled_mesa()

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,4 @@
^CMake Error at CMP0030-OLD.cmake:2 \(use_mangled_mesa\):
use_mangled_mesa called with incorrect number of arguments
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)$

View File

@ -0,0 +1,2 @@
cmake_policy(SET CMP0030 OLD)
use_mangled_mesa()

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,12 @@
CMake Warning \(dev\) at CMP0030-WARN.cmake:1 \(use_mangled_mesa\):
Policy CMP0030 is not set: The use_mangled_mesa command should not be
called. Run "cmake --help-policy CMP0030" 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 CMP0030-WARN.cmake:1 \(use_mangled_mesa\):
use_mangled_mesa called with incorrect number of arguments
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -0,0 +1 @@
use_mangled_mesa()

View File

@ -2,6 +2,7 @@ include(RunCMake)
foreach(p
CMP0029
CMP0030
)
run_cmake(${p}-WARN)
run_cmake(${p}-OLD)