summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2023-07-24 20:59:28 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2023-07-25 15:09:56 (GMT)
commitff12a57d5e459fac4cf2b11f90a681bc165c4a42 (patch)
tree51667de8b7d56a7e7477bc7a738d963a30a38310
parent89a692aa18d0d1f80c131fdc3eba34fea195f00a (diff)
downloadCMake-ff12a57d5e459fac4cf2b11f90a681bc165c4a42.zip
CMake-ff12a57d5e459fac4cf2b11f90a681bc165c4a42.tar.gz
CMake-ff12a57d5e459fac4cf2b11f90a681bc165c4a42.tar.bz2
exec_program(): Remove by policy CMP0153
-rw-r--r--Help/command/exec_program.rst4
-rw-r--r--Help/manual/cmake-policies.7.rst1
-rw-r--r--Help/policy/CMP0153.rst12
-rw-r--r--Help/release/dev/exec_program-policy.rst6
-rw-r--r--Source/cmCommands.cxx4
-rw-r--r--Source/cmPolicies.h4
-rw-r--r--Tests/RunCMake/CMP0153/CMP0153-NEW-result.txt1
-rw-r--r--Tests/RunCMake/CMP0153/CMP0153-NEW-stderr.txt3
-rw-r--r--Tests/RunCMake/CMP0153/CMP0153-NEW-stdout.txt1
-rw-r--r--Tests/RunCMake/CMP0153/CMP0153-NEW.cmake2
-rw-r--r--Tests/RunCMake/CMP0153/CMP0153-OLD-stdout.txt1
-rw-r--r--Tests/RunCMake/CMP0153/CMP0153-OLD.cmake2
-rw-r--r--Tests/RunCMake/CMP0153/CMP0153-WARN-stderr.txt6
-rw-r--r--Tests/RunCMake/CMP0153/CMP0153-WARN-stdout.txt1
-rw-r--r--Tests/RunCMake/CMP0153/CMP0153-WARN.cmake1
-rw-r--r--Tests/RunCMake/CMP0153/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0153/RunCMakeTest.cmake9
-rw-r--r--Tests/RunCMake/CMakeLists.txt2
18 files changed, 61 insertions, 2 deletions
diff --git a/Help/command/exec_program.rst b/Help/command/exec_program.rst
index 983a6df..6010176 100644
--- a/Help/command/exec_program.rst
+++ b/Help/command/exec_program.rst
@@ -1,6 +1,10 @@
exec_program
------------
+.. versionchanged:: 3.28
+ This command is available only if policy :policy:`CMP0153` is not set to ``NEW``.
+ Port projects to the :command:`execute_process` command.
+
.. deprecated:: 3.0
Use the :command:`execute_process` command instead.
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 89b7924..a018aff 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -57,6 +57,7 @@ Policies Introduced by CMake 3.28
.. toctree::
:maxdepth: 1
+ CMP0153: The exec_program command should not be called. </policy/CMP0153>
CMP0152: file(REAL_PATH) resolves symlinks before collapsing ../ components. </policy/CMP0152>
Policies Introduced by CMake 3.27
diff --git a/Help/policy/CMP0153.rst b/Help/policy/CMP0153.rst
new file mode 100644
index 0000000..4c9f3dc
--- /dev/null
+++ b/Help/policy/CMP0153.rst
@@ -0,0 +1,12 @@
+CMP0153
+-------
+
+The :command:`exec_program` command should not be called.
+
+This command has long been superseded by the :command:`execute_process`
+command and has been deprecated since CMake 3.0.
+
+.. |disallowed_version| replace:: 3.28
+.. include:: DISALLOWED_COMMAND.txt
+
+.. include:: DEPRECATED.txt
diff --git a/Help/release/dev/exec_program-policy.rst b/Help/release/dev/exec_program-policy.rst
new file mode 100644
index 0000000..8ddae5b
--- /dev/null
+++ b/Help/release/dev/exec_program-policy.rst
@@ -0,0 +1,6 @@
+exec_program-policy
+-------------------
+
+* The :command:`exec_program` command, which has been deprecated since CMake
+ 3.0, has been removed by policy :policy:`CMP0153`. Use the
+ :command:`execute_process` command instead.
diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx
index ae83b2e..2ee4f47 100644
--- a/Source/cmCommands.cxx
+++ b/Source/cmCommands.cxx
@@ -135,7 +135,6 @@ void GetScriptingCommands(cmState* state)
state->AddBuiltinCommand("cmake_path", cmCMakePathCommand);
state->AddBuiltinCommand("cmake_policy", cmCMakePolicyCommand);
state->AddBuiltinCommand("configure_file", cmConfigureFileCommand);
- state->AddBuiltinCommand("exec_program", cmExecProgramCommand);
state->AddBuiltinCommand("execute_process", cmExecuteProcessCommand);
state->AddBuiltinCommand("file", cmFileCommand);
state->AddBuiltinCommand("find_file", cmFindFile);
@@ -220,6 +219,9 @@ void GetScriptingCommands(cmState* state)
state->AddDisallowedCommand(
"use_mangled_mesa", cmUseMangledMesaCommand, cmPolicies::CMP0030,
"The use_mangled_mesa command should not be called; see CMP0030.");
+ state->AddDisallowedCommand(
+ "exec_program", cmExecProgramCommand, cmPolicies::CMP0153,
+ "The exec_program command should not be called; see CMP0153.");
#endif
}
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index 25af6a8..26c141d 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -463,7 +463,9 @@ class cmMakefile;
SELECT( \
POLICY, CMP0152, \
"file(REAL_PATH) resolves symlinks before collapsing ../ components.", 3, \
- 28, 0, cmPolicies::WARN)
+ 28, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0153, "The exec_program command should not be called.", \
+ 3, 28, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \
diff --git a/Tests/RunCMake/CMP0153/CMP0153-NEW-result.txt b/Tests/RunCMake/CMP0153/CMP0153-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0153/CMP0153-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0153/CMP0153-NEW-stderr.txt b/Tests/RunCMake/CMP0153/CMP0153-NEW-stderr.txt
new file mode 100644
index 0000000..e24eee7
--- /dev/null
+++ b/Tests/RunCMake/CMP0153/CMP0153-NEW-stderr.txt
@@ -0,0 +1,3 @@
+^CMake Error at [^
+]*/Tests/RunCMake/CMP0153/CMP0153-NEW\.cmake:[0-9]+ \(exec_program\):
+ The exec_program command should not be called; see CMP0153\.$
diff --git a/Tests/RunCMake/CMP0153/CMP0153-NEW-stdout.txt b/Tests/RunCMake/CMP0153/CMP0153-NEW-stdout.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/CMP0153/CMP0153-NEW-stdout.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/CMP0153/CMP0153-NEW.cmake b/Tests/RunCMake/CMP0153/CMP0153-NEW.cmake
new file mode 100644
index 0000000..d252b46
--- /dev/null
+++ b/Tests/RunCMake/CMP0153/CMP0153-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0153 NEW)
+exec_program("${CMAKE_COMMAND}" ARGS "-E echo \"exec_program() called\"")
diff --git a/Tests/RunCMake/CMP0153/CMP0153-OLD-stdout.txt b/Tests/RunCMake/CMP0153/CMP0153-OLD-stdout.txt
new file mode 100644
index 0000000..1aa5183
--- /dev/null
+++ b/Tests/RunCMake/CMP0153/CMP0153-OLD-stdout.txt
@@ -0,0 +1 @@
+exec_program\(\) called
diff --git a/Tests/RunCMake/CMP0153/CMP0153-OLD.cmake b/Tests/RunCMake/CMP0153/CMP0153-OLD.cmake
new file mode 100644
index 0000000..d3c47a7
--- /dev/null
+++ b/Tests/RunCMake/CMP0153/CMP0153-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0153 OLD)
+exec_program("${CMAKE_COMMAND}" ARGS "-E echo \"exec_program() called\"")
diff --git a/Tests/RunCMake/CMP0153/CMP0153-WARN-stderr.txt b/Tests/RunCMake/CMP0153/CMP0153-WARN-stderr.txt
new file mode 100644
index 0000000..8f22d4e
--- /dev/null
+++ b/Tests/RunCMake/CMP0153/CMP0153-WARN-stderr.txt
@@ -0,0 +1,6 @@
+^CMake Warning \(dev\) at [^
+]*/Tests/RunCMake/CMP0153/CMP0153-WARN\.cmake:[0-9]+ \(exec_program\):
+ Policy CMP0153 is not set: The exec_program command should not be called\.
+ Run "cmake --help-policy CMP0153" for policy details\. Use the cmake_policy
+ command to set the policy and suppress this warning\.
+This warning is for project developers\. Use -Wno-dev to suppress it\.$
diff --git a/Tests/RunCMake/CMP0153/CMP0153-WARN-stdout.txt b/Tests/RunCMake/CMP0153/CMP0153-WARN-stdout.txt
new file mode 100644
index 0000000..1aa5183
--- /dev/null
+++ b/Tests/RunCMake/CMP0153/CMP0153-WARN-stdout.txt
@@ -0,0 +1 @@
+exec_program\(\) called
diff --git a/Tests/RunCMake/CMP0153/CMP0153-WARN.cmake b/Tests/RunCMake/CMP0153/CMP0153-WARN.cmake
new file mode 100644
index 0000000..ba81501
--- /dev/null
+++ b/Tests/RunCMake/CMP0153/CMP0153-WARN.cmake
@@ -0,0 +1 @@
+exec_program("${CMAKE_COMMAND}" ARGS "-E echo \"exec_program() called\"")
diff --git a/Tests/RunCMake/CMP0153/CMakeLists.txt b/Tests/RunCMake/CMP0153/CMakeLists.txt
new file mode 100644
index 0000000..922aad6
--- /dev/null
+++ b/Tests/RunCMake/CMP0153/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.27)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0153/RunCMakeTest.cmake b/Tests/RunCMake/CMP0153/RunCMakeTest.cmake
new file mode 100644
index 0000000..3d01dbf
--- /dev/null
+++ b/Tests/RunCMake/CMP0153/RunCMakeTest.cmake
@@ -0,0 +1,9 @@
+include(RunCMake)
+
+function(run_cmp0153 name)
+ run_cmake_command(${name} ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/${name}.cmake")
+endfunction()
+
+run_cmp0153(CMP0153-WARN)
+run_cmp0153(CMP0153-OLD)
+run_cmp0153(CMP0153-NEW)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 608a4d9..d20af29 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -169,6 +169,8 @@ if(NOT WIN32 OR CYGWIN)
add_RunCMake_test(CMP0152)
endif()
+add_RunCMake_test(CMP0153)
+
# The test for Policy 65 requires the use of the
# CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode
# generators ignore. The policy will have no effect on those generators.