Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
CMake
CMake
Commits
aa76518f
Commit
aa76518f
authored
Oct 18, 2013
by
Brad King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add policy CMP0031 to disallow load_command
parent
97268cf5
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
56 additions
and
22 deletions
+56
-22
Help/command/load_command.rst
Help/command/load_command.rst
+2
-0
Help/manual/cmake-policies.7.rst
Help/manual/cmake-policies.7.rst
+1
-0
Help/policy/CMP0031.rst
Help/policy/CMP0031.rst
+13
-0
Source/cmLoadCommandCommand.cxx
Source/cmLoadCommandCommand.cxx
+3
-0
Source/cmLoadCommandCommand.h
Source/cmLoadCommandCommand.h
+2
-22
Source/cmPolicies.cxx
Source/cmPolicies.cxx
+5
-0
Source/cmPolicies.h
Source/cmPolicies.h
+1
-0
Tests/RunCMake/DisallowedCommands/CMP0031-NEW-result.txt
Tests/RunCMake/DisallowedCommands/CMP0031-NEW-result.txt
+1
-0
Tests/RunCMake/DisallowedCommands/CMP0031-NEW-stderr.txt
Tests/RunCMake/DisallowedCommands/CMP0031-NEW-stderr.txt
+4
-0
Tests/RunCMake/DisallowedCommands/CMP0031-NEW.cmake
Tests/RunCMake/DisallowedCommands/CMP0031-NEW.cmake
+2
-0
Tests/RunCMake/DisallowedCommands/CMP0031-OLD-result.txt
Tests/RunCMake/DisallowedCommands/CMP0031-OLD-result.txt
+1
-0
Tests/RunCMake/DisallowedCommands/CMP0031-OLD-stderr.txt
Tests/RunCMake/DisallowedCommands/CMP0031-OLD-stderr.txt
+4
-0
Tests/RunCMake/DisallowedCommands/CMP0031-OLD.cmake
Tests/RunCMake/DisallowedCommands/CMP0031-OLD.cmake
+2
-0
Tests/RunCMake/DisallowedCommands/CMP0031-WARN-result.txt
Tests/RunCMake/DisallowedCommands/CMP0031-WARN-result.txt
+1
-0
Tests/RunCMake/DisallowedCommands/CMP0031-WARN-stderr.txt
Tests/RunCMake/DisallowedCommands/CMP0031-WARN-stderr.txt
+12
-0
Tests/RunCMake/DisallowedCommands/CMP0031-WARN.cmake
Tests/RunCMake/DisallowedCommands/CMP0031-WARN.cmake
+1
-0
Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake
Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake
+1
-0
No files found.
Help/command/load_command.rst
View file @
aa76518f
load_command
------------
Disallowed. See CMake Policy :policy:`CMP0031`.
Load a command into a running CMake.
::
...
...
Help/manual/cmake-policies.7.rst
View file @
aa76518f
...
...
@@ -60,3 +60,4 @@ All Policies
/policy/CMP0028
/policy/CMP0029
/policy/CMP0030
/policy/CMP0031
Help/policy/CMP0031.rst
0 → 100644
View file @
aa76518f
CMP0031
-------
The :command:`load_command` command should not be called.
This command was added in August 2002 to allow projects to add
arbitrary commands implemented in C or C++. However, it does
not work when the toolchain in use does not match the ABI of
the CMake process. It has been mostly superseded by the
:command:`macro` and :command:`function` commands.
.. |disallowed_version| replace:: 3.0.0
.. include:: DISALLOWED_COMMAND.txt
Source/cmLoadCommandCommand.cxx
View file @
aa76518f
...
...
@@ -189,6 +189,9 @@ cmLoadedCommand::~cmLoadedCommand()
bool
cmLoadCommandCommand
::
InitialPass
(
std
::
vector
<
std
::
string
>
const
&
args
,
cmExecutionStatus
&
)
{
if
(
this
->
Disallowed
(
cmPolicies
::
CMP0031
,
"The load_command command should not be called; see CMP0031."
))
{
return
true
;
}
if
(
args
.
size
()
<
1
)
{
return
true
;
...
...
Source/cmLoadCommandCommand.h
View file @
aa76518f
...
...
@@ -14,34 +14,14 @@
#include "cmCommand.h"
/** \class cmLoadCommandCommand
* \brief Load in a Command plugin
*
* cmLoadCommandCommand loads a command into CMake
*/
class
cmLoadCommandCommand
:
public
cmCommand
{
public:
/**
* This is a virtual constructor for the command.
*/
virtual
cmCommand
*
Clone
()
{
return
new
cmLoadCommandCommand
;
}
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
virtual
cmCommand
*
Clone
()
{
return
new
cmLoadCommandCommand
;
}
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
"load_command"
;}
virtual
bool
IsDiscouraged
()
const
{
return
true
;
}
cmTypeMacro
(
cmLoadCommandCommand
,
cmCommand
);
};
...
...
Source/cmPolicies.cxx
View file @
aa76518f
...
...
@@ -256,6 +256,11 @@ cmPolicies::cmPolicies()
CMP0030
,
"CMP0030"
,
"The use_mangled_mesa command should not be called."
,
3
,
0
,
0
,
0
,
cmPolicies
::
WARN
);
this
->
DefinePolicy
(
CMP0031
,
"CMP0031"
,
"The load_command command should not be called."
,
3
,
0
,
0
,
0
,
cmPolicies
::
WARN
);
}
cmPolicies
::~
cmPolicies
()
...
...
Source/cmPolicies.h
View file @
aa76518f
...
...
@@ -82,6 +82,7 @@ public:
CMP0028
,
///< Double colon in target name means ALIAS or IMPORTED target.
CMP0029
,
///< Disallow command: subdir_depends
CMP0030
,
///< Disallow command: use_mangled_mesa
CMP0031
,
///< Disallow command: load_command
/** \brief Always the last entry.
*
...
...
Tests/RunCMake/DisallowedCommands/CMP0031-NEW-result.txt
0 → 100644
View file @
aa76518f
1
Tests/RunCMake/DisallowedCommands/CMP0031-NEW-stderr.txt
0 → 100644
View file @
aa76518f
CMake Error at CMP0031-NEW.cmake:2 \(load_command\):
The load_command command should not be called; see CMP0031.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
Tests/RunCMake/DisallowedCommands/CMP0031-NEW.cmake
0 → 100644
View file @
aa76518f
cmake_policy
(
SET CMP0031 NEW
)
load_command
()
Tests/RunCMake/DisallowedCommands/CMP0031-OLD-result.txt
0 → 100644
View file @
aa76518f
1
Tests/RunCMake/DisallowedCommands/CMP0031-OLD-stderr.txt
0 → 100644
View file @
aa76518f
CMake Error at CMP0031-OLD.cmake:2 \(load_command\):
load_command Attempt to load command failed from file.*bogus_command.*
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
Tests/RunCMake/DisallowedCommands/CMP0031-OLD.cmake
0 → 100644
View file @
aa76518f
cmake_policy
(
SET CMP0031 OLD
)
load_command
(
bogus_command
)
Tests/RunCMake/DisallowedCommands/CMP0031-WARN-result.txt
0 → 100644
View file @
aa76518f
1
Tests/RunCMake/DisallowedCommands/CMP0031-WARN-stderr.txt
0 → 100644
View file @
aa76518f
CMake Warning \(dev\) at CMP0031-WARN.cmake:1 \(load_command\):
Policy CMP0031 is not set: The load_command command should not be called.
Run "cmake --help-policy CMP0031" 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 CMP0031-WARN.cmake:1 \(load_command\):
load_command Attempt to load command failed from file.*bogus_command.*
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)
Tests/RunCMake/DisallowedCommands/CMP0031-WARN.cmake
0 → 100644
View file @
aa76518f
load_command
(
bogus_command
)
Tests/RunCMake/DisallowedCommands/RunCMakeTest.cmake
View file @
aa76518f
...
...
@@ -3,6 +3,7 @@ include(RunCMake)
foreach
(
p
CMP0029
CMP0030
CMP0031
)
run_cmake
(
${
p
}
-WARN
)
run_cmake
(
${
p
}
-OLD
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment