Commit 1d1fa5d3 authored by Brad King's avatar Brad King

Tests: Add RunCMake.CPackCommandLine case for multi-config package

In commit da5ac4bb (cpack: Add `CPACK_INSTALL_CMAKE_CONFIGURATIONS`
variable, 2019-07-10, v3.16.0-rc1~165^2) we added support for running
the `cpack -C ...` command-line with multiple configurations.  Add an
explicit test for this.

Fixes: #19918
parent 108207cc
cmake_minimum_required(VERSION 3.16)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
MultiConfig-0\.1\.1-[^/
]*/lib/(lib|)foo_dbg\.(a|lib)
MultiConfig-0\.1\.1-[^/
]*/lib/(lib|)foo_rel\.(a|lib)
^CPack: Create package using ZIP
CPack: Install projects
CPack: - Install project: MultiConfig \[Debug\]
CPack: - Install project: MultiConfig \[Release\]
CPack: Create package
CPack: - package: [^
]*/Tests/RunCMake/CPackCommandLine/MultiConfig-build/MultiConfig-0.1.1-[^
]*.zip generated.$
enable_language(C)
include(CPack)
add_library(foo foo.c)
set_property(TARGET foo PROPERTY DEBUG_POSTFIX _dbg)
set_property(TARGET foo PROPERTY RELEASE_POSTFIX _rel)
install(TARGETS foo)
......@@ -8,3 +8,26 @@ 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)
function(run_MultiConfig)
set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/MultiConfig-build")
run_cmake(MultiConfig)
set(RunCMake_TEST_NO_CLEAN 1)
run_cmake_command(MultiConfig-build-dbg ${CMAKE_COMMAND} --build . --config Debug)
run_cmake_command(MultiConfig-build-rel ${CMAKE_COMMAND} --build . --config Release)
run_cmake_command(MultiConfig-package ${CMAKE_CPACK_COMMAND} -G ZIP -C "Debug\;Release")
set(zip_glob "${RunCMake_TEST_BINARY_DIR}/MultiConfig-0.1.1-*.zip")
file(GLOB zips "${zip_glob}")
set(zip_found 0)
foreach(zip IN LISTS zips)
set(zip_found 1)
run_cmake_command(MultiConfig-check ${CMAKE_COMMAND} -E tar tf "${zip}")
endforeach()
if(NOT zip_found)
message(SEND_ERROR "No package file found at\n ${zip_glob}")
endif()
endfunction()
if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode")
run_MultiConfig()
endif()
int foo(void)
{
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment