summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CommandLine
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-03-18 11:20:18 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-03-18 11:20:24 (GMT)
commit5dbd068827510496a5561c07e2e7221b8090b241 (patch)
tree1596babf6fc0de3887e3d8c94bee0c9fcbf1f039 /Tests/RunCMake/CommandLine
parent41b5f49eff605910736ec93f1fca4e539319b693 (diff)
parent36056ff5a38e72f2edf7f042d594d0356301bb9e (diff)
downloadCMake-5dbd068827510496a5561c07e2e7221b8090b241.zip
CMake-5dbd068827510496a5561c07e2e7221b8090b241.tar.gz
CMake-5dbd068827510496a5561c07e2e7221b8090b241.tar.bz2
Merge topic 'cmake-P-args'
36056ff5a3 cmake: Improve acceptance of arbitrary arguments in -P script mode Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7083
Diffstat (limited to 'Tests/RunCMake/CommandLine')
-rw-r--r--Tests/RunCMake/CommandLine/P_arbitrary_args-stdout.txt8
-rw-r--r--Tests/RunCMake/CommandLine/P_arbitrary_args.cmake11
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake2
3 files changed, 17 insertions, 4 deletions
diff --git a/Tests/RunCMake/CommandLine/P_arbitrary_args-stdout.txt b/Tests/RunCMake/CommandLine/P_arbitrary_args-stdout.txt
new file mode 100644
index 0000000..c0f96f3
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/P_arbitrary_args-stdout.txt
@@ -0,0 +1,8 @@
+^-- CMAKE_ARGC='7'
+-- CMAKE_ARGV1='-P'
+-- CMAKE_ARGV2='[^']*/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake'
+-- CMAKE_ARGV3='--'
+-- CMAKE_ARGV4='-DFOO'
+-- CMAKE_ARGV5='-S'
+-- CMAKE_ARGV6='-B'
+-- CMAKE_ARGV7=''$
diff --git a/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake b/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake
index 29faae3..d0a4859 100644
--- a/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake
+++ b/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake
@@ -1,3 +1,8 @@
-if(NOT ("${CMAKE_ARGV3}" STREQUAL "--" AND "${CMAKE_ARGV4}" STREQUAL "-DFOO"))
- message(FATAL_ERROR "`-DFOO` shouldn't trigger an error after `--`")
-endif()
+message(STATUS "CMAKE_ARGC='${CMAKE_ARGC}'")
+message(STATUS "CMAKE_ARGV1='${CMAKE_ARGV1}'")
+message(STATUS "CMAKE_ARGV2='${CMAKE_ARGV2}'")
+message(STATUS "CMAKE_ARGV3='${CMAKE_ARGV3}'")
+message(STATUS "CMAKE_ARGV4='${CMAKE_ARGV4}'")
+message(STATUS "CMAKE_ARGV5='${CMAKE_ARGV5}'")
+message(STATUS "CMAKE_ARGV6='${CMAKE_ARGV6}'")
+message(STATUS "CMAKE_ARGV7='${CMAKE_ARGV7}'")
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 0d7ac06..22a59f2 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -52,7 +52,7 @@ run_cmake_command(G_no-arg ${CMAKE_COMMAND} -B DummyBuildDir -G)
run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -B DummyBuildDir -G NoSuchGenerator)
run_cmake_command(P_no-arg ${CMAKE_COMMAND} -P)
run_cmake_command(P_no-file ${CMAKE_COMMAND} -P nosuchscriptfile.cmake)
-run_cmake_command(P_arbitrary_args ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_arbitrary_args.cmake" -- -DFOO)
+run_cmake_command(P_arbitrary_args ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_arbitrary_args.cmake" -- -DFOO -S -B)
run_cmake_command(build-no-dir
${CMAKE_COMMAND} --build)