diff options
author | Alex Turbov <i.zaufi@gmail.com> | 2019-11-10 12:20:29 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-12-09 22:06:10 (GMT) |
commit | 3476dbe6d76aee7409796e3dfd1da6a0c15e7b21 (patch) | |
tree | 54603d78864a7db7802090b5a02235a26a7554a9 /Tests | |
parent | a9c09599002baa27bdf4f98664829a92ba529240 (diff) | |
download | CMake-3476dbe6d76aee7409796e3dfd1da6a0c15e7b21.zip CMake-3476dbe6d76aee7409796e3dfd1da6a0c15e7b21.tar.gz CMake-3476dbe6d76aee7409796e3dfd1da6a0c15e7b21.tar.bz2 |
CPack: CMAKE_PROJECT_HOMEPAGE_URL -> CPACK_PACKAGE_HOMEPAGE_URL
At CPack running time the `CMAKE_PROJECT_HOMEPAGE_URL` variable
is not set.
Internal CPack modules (e.g. CPackDEB, CPackRPM, CPackFreeBSD)
should use `CPACK_PACKAGE_HOMEPAGE_URL` instead, which is available
after inclusion of `CPack.cmake` into `CMakeLists.txt`.
Closes: #19607
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/tests/PROJECT_META/ExpectedFiles.cmake | 9 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/tests/PROJECT_META/VerifyResult.cmake | 30 | ||||
-rw-r--r-- | Tests/RunCMake/CPack/tests/PROJECT_META/test.cmake | 11 |
5 files changed, 53 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 0a090a8..1e485c4 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -553,6 +553,7 @@ set(cpack_tests DEB.MD5SUMS DEB.DEB_PACKAGE_VERSION_BACK_COMPATIBILITY DEB.DEB_DESCRIPTION + DEB.PROJECT_META RPM.CUSTOM_BINARY_SPEC_FILE RPM.CUSTOM_NAMES @@ -573,6 +574,7 @@ set(cpack_tests RPM.SUGGESTS RPM.SYMLINKS RPM.USER_FILELIST + RPM.PROJECT_META 7Z TBZ2 diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake index b0b7a99..5fce32a 100644 --- a/Tests/RunCMake/CPack/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake @@ -46,3 +46,4 @@ run_cpack_test_subtests( false "MONOLITHIC;COMPONENT" ) +run_cpack_test(PROJECT_META "RPM.PROJECT_META;DEB.PROJECT_META" false "MONOLITHIC;COMPONENT") diff --git a/Tests/RunCMake/CPack/tests/PROJECT_META/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/PROJECT_META/ExpectedFiles.cmake new file mode 100644 index 0000000..448ed2b --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PROJECT_META/ExpectedFiles.cmake @@ -0,0 +1,9 @@ +if(GENERATOR_TYPE STREQUAL DEB) + set(EXPECTED_FILE_1 "project_meta-1.2.3*.deb") +elseif(GENERATOR_TYPE STREQUAL RPM) + set(EXPECTED_FILE_1 "project_meta-1.2.3*.rpm") +else() + message(FATAL_ERROR "Unexpected CPack generator") +endif() +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/PROJECT_META/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/PROJECT_META/VerifyResult.cmake new file mode 100644 index 0000000..b3accb5 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PROJECT_META/VerifyResult.cmake @@ -0,0 +1,30 @@ +function(checkPackageURL FILE TAG EXPECTED_URL) + getPackageInfo("${FILE}" "_file_info") + string(REPLACE "\n" ";" _file_info "${_file_info}") + + set(_seen_url FALSE) + foreach(_line IN LISTS _file_info) + if(_line MATCHES "${TAG}: (.*)") + set(_seen_url TRUE) + if(NOT CMAKE_MATCH_1 STREQUAL EXPECTED_URL) + message(FATAL_ERROR "Unexpected `Homepage` URL: `${CMAKE_MATCH_1}` != `${EXPECTED_URL}`") + endif() + break() + endif() + endforeach() + if(NOT _seen_url) + message(FATAL_ERROR "The packge `${FILE}` do not have URL as expected") + endif() +endfunction() + +if(GENERATOR_TYPE STREQUAL DEB) + set(_tag " Homepage") # NOTE The leading space +elseif(GENERATOR_TYPE STREQUAL RPM) + set(_tag "URL.*") +else() + message(FATAL_ERROR "Unexpected CPack generator") +endif() + +checkPackageURL("${FOUND_FILE_1}" "${_tag}" "https://meta.test.info") + +# kate: indent-width 2; diff --git a/Tests/RunCMake/CPack/tests/PROJECT_META/test.cmake b/Tests/RunCMake/CPack/tests/PROJECT_META/test.cmake new file mode 100644 index 0000000..9c5266a --- /dev/null +++ b/Tests/RunCMake/CPack/tests/PROJECT_META/test.cmake @@ -0,0 +1,11 @@ +project( + MetaInfoTest + VERSION 1.2.3 + DESCRIPTION "This is going to be a summary" + HOMEPAGE_URL "https://meta.test.info" +) +install(FILES CMakeLists.txt DESTINATION foo COMPONENT test) + +if(PACKAGING_TYPE STREQUAL "COMPONENT") + set(CPACK_COMPONENTS_ALL test) +endif() |