diff options
author | Domen Vrankar <domen.vrankar@gmail.com> | 2015-06-05 19:03:26 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-06-15 19:09:07 (GMT) |
commit | e726fc025a3543c0be8a4eb217b0a80f9c16051c (patch) | |
tree | 2ed4f4114caff68ff16d06fc2e0e518ff6f5a771 /Tests/RunCMake/CMakeLists.txt | |
parent | 092f1539af99e031c99a74d5a0f24731f58bf10a (diff) | |
download | CMake-e726fc025a3543c0be8a4eb217b0a80f9c16051c.zip CMake-e726fc025a3543c0be8a4eb217b0a80f9c16051c.tar.gz CMake-e726fc025a3543c0be8a4eb217b0a80f9c16051c.tar.bz2 |
Tests: Add RunCMake tests for CPack{Deb,RPM}
Add script structure for easier addition of new CPack related tests.
Diffstat (limited to 'Tests/RunCMake/CMakeLists.txt')
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 592b5e4..f4abed2 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -26,6 +26,39 @@ macro(add_RunCMake_test test) ) endmacro() +function(add_RunCMake_test_group test types) + # create directory for common content + set(TEST_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/${test}/conf") + file(REMOVE_RECURSE "${TEST_CONFIG_DIR}") + file(MAKE_DIRECTORY "${TEST_CONFIG_DIR}") + + foreach(type IN LISTS types) + # generate prerequirements config file in cmake as ctest doesn't have as + # much system information so it is easier to set programs and environment + # values here + unset(${test}_${type}_FOUND_PREREQUIREMENTS) + include("${CMAKE_CURRENT_SOURCE_DIR}/${test}/${type}/Prerequirements.cmake") + get_test_prerequirements("${test}_${type}_FOUND_PREREQUIREMENTS" + "${TEST_CONFIG_DIR}/${type}_config.cmake") + + # only add the test if prerequirements are met + if(${test}_${type}_FOUND_PREREQUIREMENTS) + add_test(NAME RunCMake.${test}_${type} COMMAND ${CMAKE_CMAKE_COMMAND} + -DTEST_TYPE=${type} + -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR} + -DRunCMake_GENERATOR=${CMAKE_GENERATOR} + -DRunCMake_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} + -DRunCMake_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} + -DRunCMake_MAKE_PROGRAM=${CMake_TEST_EXPLICIT_MAKE_PROGRAM} + -DRunCMake_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/${test} + -DRunCMake_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/${type}/${test} + -Dconfig_file=${TEST_CONFIG_DIR}/${type}_config.cmake + -P "${CMAKE_CURRENT_SOURCE_DIR}/${test}/RunCMakeTest.cmake" + ) + endif() + endforeach() +endfunction() + if(XCODE_VERSION AND "${XCODE_VERSION}" VERSION_LESS 3) set(GeneratorToolset_ARGS -DXCODE_BELOW_3=1) endif() @@ -233,3 +266,5 @@ if("${CMAKE_GENERATOR}" MATCHES "Make|Ninja") add_executable(pseudo_iwyu pseudo_iwyu.c) add_RunCMake_test(IncludeWhatYouUse -DPSEUDO_IWYU=$<TARGET_FILE:pseudo_iwyu>) endif() + +add_RunCMake_test_group(CPack "DEB;RPM") |