summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CPackCommandLine
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-04-10 17:14:02 (GMT)
committerBrad King <brad.king@kitware.com>2018-04-10 19:00:37 (GMT)
commit6f2701abf60bc8c0aeed14e09adf28d59023da87 (patch)
tree85143259d399ae5ed7718f2cec36aa1d9b15fef1 /Tests/RunCMake/CPackCommandLine
parent61fd4c742013a7f9139db190f936703b656540ff (diff)
downloadCMake-6f2701abf60bc8c0aeed14e09adf28d59023da87.zip
CMake-6f2701abf60bc8c0aeed14e09adf28d59023da87.tar.gz
CMake-6f2701abf60bc8c0aeed14e09adf28d59023da87.tar.bz2
CPack: Fix crash on invalid generator name
In commit v3.11.0-rc1~68^2 (CPack: accept --trace and --trace-expand, 2017-12-09) a nullptr dereference was added that occurs when `cpack -G NotAGenerator` is invoked. Add the needed condition. Fixes: #17900
Diffstat (limited to 'Tests/RunCMake/CPackCommandLine')
-rw-r--r--Tests/RunCMake/CPackCommandLine/NotAGenerator-result.txt1
-rw-r--r--Tests/RunCMake/CPackCommandLine/NotAGenerator-stderr.txt1
-rw-r--r--Tests/RunCMake/CPackCommandLine/RunCMakeTest.cmake10
3 files changed, 12 insertions, 0 deletions
diff --git a/Tests/RunCMake/CPackCommandLine/NotAGenerator-result.txt b/Tests/RunCMake/CPackCommandLine/NotAGenerator-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CPackCommandLine/NotAGenerator-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CPackCommandLine/NotAGenerator-stderr.txt b/Tests/RunCMake/CPackCommandLine/NotAGenerator-stderr.txt
new file mode 100644
index 0000000..fe4e455
--- /dev/null
+++ b/Tests/RunCMake/CPackCommandLine/NotAGenerator-stderr.txt
@@ -0,0 +1 @@
+^CPack Error: Cannot initialize CPack generator: NotAGenerator
diff --git a/Tests/RunCMake/CPackCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CPackCommandLine/RunCMakeTest.cmake
new file mode 100644
index 0000000..991146c
--- /dev/null
+++ b/Tests/RunCMake/CPackCommandLine/RunCMakeTest.cmake
@@ -0,0 +1,10 @@
+include(RunCMake)
+set(RunCMake_TEST_TIMEOUT 60)
+
+file(WRITE "${RunCMake_BINARY_DIR}/NotAGenerator-build/CPackConfig.cmake" [[
+set(CPACK_PACKAGE_NAME "Test")
+set(CPACK_PACKAGE_VERSION "1")
+]])
+set(RunCMake_TEST_NO_CLEAN 1)
+run_cmake_command(NotAGenerator ${CMAKE_CPACK_COMMAND} -G NotAGenerator)
+unset(RunCMake_TEST_NO_CLEAN)