diff options
author | Brad King <brad.king@kitware.com> | 2018-04-10 17:14:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-04-10 19:00:37 (GMT) |
commit | 6f2701abf60bc8c0aeed14e09adf28d59023da87 (patch) | |
tree | 85143259d399ae5ed7718f2cec36aa1d9b15fef1 /Tests/RunCMake | |
parent | 61fd4c742013a7f9139db190f936703b656540ff (diff) | |
download | CMake-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')
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CPackCommandLine/NotAGenerator-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CPackCommandLine/NotAGenerator-stderr.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CPackCommandLine/RunCMakeTest.cmake | 10 |
4 files changed, 13 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index d5bd297..c52f44e 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -335,6 +335,7 @@ add_RunCMake_test(CommandLine -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) add_RunCMake_test(CommandLineTar) add_RunCMake_test(install) +add_RunCMake_test(CPackCommandLine) add_RunCMake_test(CPackConfig) add_RunCMake_test(CPackInstallProperties) add_RunCMake_test(ExternalProject) 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) |