diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2018-07-13 13:47:31 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2018-07-17 13:07:10 (GMT) |
commit | 36ef57a9392fb5b3e688ff95547836d433db01c9 (patch) | |
tree | 1a3b31d5d60c7e1cf19401f707030f2f357f2369 /Tests/RunCMake/CPack/CPackTestHelpers.cmake | |
parent | 11ca374b284603278eded2548bbc9d7de88706e9 (diff) | |
download | CMake-36ef57a9392fb5b3e688ff95547836d433db01c9.zip CMake-36ef57a9392fb5b3e688ff95547836d433db01c9.tar.gz CMake-36ef57a9392fb5b3e688ff95547836d433db01c9.tar.bz2 |
Tests: Add test for cmake --build . --target package
Diffstat (limited to 'Tests/RunCMake/CPack/CPackTestHelpers.cmake')
-rw-r--r-- | Tests/RunCMake/CPack/CPackTestHelpers.cmake | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/Tests/RunCMake/CPack/CPackTestHelpers.cmake b/Tests/RunCMake/CPack/CPackTestHelpers.cmake index 447b08b..8c9f4b4 100644 --- a/Tests/RunCMake/CPack/CPackTestHelpers.cmake +++ b/Tests/RunCMake/CPack/CPackTestHelpers.cmake @@ -1,10 +1,14 @@ cmake_policy(SET CMP0057 NEW) -function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACKAGING_TYPE) +function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACKAGING_TYPE package_target) if(TEST_TYPE IN_LIST types) set(RunCMake_TEST_NO_CLEAN TRUE) - set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${TEST_NAME}-build") - set(full_test_name_ "${TEST_NAME}") + if(package_target) + set(full_test_name_ "${TEST_NAME}-package-target") + else() + set(full_test_name_ "${TEST_NAME}") + endif() + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/${full_test_name_}-build") if(SUBTEST_SUFFIX) set(RunCMake_TEST_BINARY_DIR "${RunCMake_TEST_BINARY_DIR}-${SUBTEST_SUFFIX}-subtest") @@ -67,9 +71,15 @@ function(run_cpack_test_common_ TEST_NAME types build SUBTEST_SUFFIX source PACK unset(pack_params_) endif() + if(package_target) + set(cpack_command_ ${CMAKE_COMMAND} --build "${RunCMake_TEST_BINARY_DIR}" --target package) + else() + set(cpack_command_ ${CMAKE_CPACK_COMMAND} ${pack_params_}) + endif() + # execute cpack execute_process( - COMMAND ${CMAKE_CPACK_COMMAND} ${pack_params_} + COMMAND ${cpack_command_} WORKING_DIRECTORY "${RunCMake_TEST_BINARY_DIR}" RESULT_VARIABLE "result_" OUTPUT_FILE "${RunCMake_TEST_BINARY_DIR}/test_output.txt" @@ -113,18 +123,24 @@ endfunction() function(run_cpack_test TEST_NAME types build PACKAGING_TYPES) foreach(packaging_type_ IN LISTS PACKAGING_TYPES) - run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}") + run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}" false) + endforeach() +endfunction() + +function(run_cpack_test_package_target TEST_NAME types build PACKAGING_TYPES) + foreach(packaging_type_ IN LISTS PACKAGING_TYPES) + run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "" false "${packaging_type_}" true) endforeach() endfunction() function(run_cpack_test_subtests TEST_NAME SUBTEST_SUFFIXES types build PACKAGING_TYPES) foreach(suffix_ IN LISTS SUBTEST_SUFFIXES) foreach(packaging_type_ IN LISTS PACKAGING_TYPES) - run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "${suffix_}" false "${packaging_type_}") + run_cpack_test_common_("${TEST_NAME}" "${types}" "${build}" "${suffix_}" false "${packaging_type_}" false) endforeach() endforeach() endfunction() function(run_cpack_source_test TEST_NAME types) - run_cpack_test_common_("${TEST_NAME}" "${types}" false "" true "") + run_cpack_test_common_("${TEST_NAME}" "${types}" false "" true "" false) endfunction() |