diff options
author | Brad King <brad.king@kitware.com> | 2024-06-24 13:28:31 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2024-06-24 13:28:44 (GMT) |
commit | d395fb38e5eddb567c116067e12fcbe680894088 (patch) | |
tree | 890b7cc11a8e9a1ef00347289576f2004a894daa /Tests | |
parent | 6832252ac4ef3e4aca229f9b758cfc23d6d203fa (diff) | |
parent | 8a06f173d906a750808ac1f5fbdbd91293ac474d (diff) | |
download | CMake-d395fb38e5eddb567c116067e12fcbe680894088.zip CMake-d395fb38e5eddb567c116067e12fcbe680894088.tar.gz CMake-d395fb38e5eddb567c116067e12fcbe680894088.tar.bz2 |
Merge topic 'apple-framework-bundle-name'
8a06f173d9 Apple: Add CFBundleName to framework Info.plist files
7c1a18655b Tests/RunCMake/Framework: Improve failure messages
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Jason Juang <jasjuang@gmail.com>
Merge-request: !9610
Diffstat (limited to 'Tests')
5 files changed, 85 insertions, 27 deletions
diff --git a/Tests/RunCMake/Framework/FrameworkLayout-check-common.cmake b/Tests/RunCMake/Framework/FrameworkLayout-check-common.cmake new file mode 100644 index 0000000..13a91df --- /dev/null +++ b/Tests/RunCMake/Framework/FrameworkLayout-check-common.cmake @@ -0,0 +1,24 @@ +macro(check_plist key expect) + execute_process( + COMMAND plutil -extract "${key}" xml1 "${plist-file}" -o - + RESULT_VARIABLE result + OUTPUT_VARIABLE actual + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(actual MATCHES "<string>([^<>]*)</string>") + set(actual "${CMAKE_MATCH_1}") + endif() + if(NOT "${actual}" STREQUAL "${expect}") + string(CONCAT RunCMake_TEST_FAILED + "Framework Info.plist key \"${key}\" has value:\n" + " \"${actual}\"\n" + "but we expected:\n" + " \"${expect}\"" + ) + endif() +endmacro() + +check_plist(CFBundleIdentifier MyFrameworkId) +check_plist(CFBundleName MyFrameworkBundleName) +check_plist(CFBundleVersion 3.2.1) +check_plist(CFBundleShortVersionString 3) diff --git a/Tests/RunCMake/Framework/FrameworkLayout.cmake b/Tests/RunCMake/Framework/FrameworkLayout.cmake index d09e8a0..e230e07 100644 --- a/Tests/RunCMake/Framework/FrameworkLayout.cmake +++ b/Tests/RunCMake/Framework/FrameworkLayout.cmake @@ -15,6 +15,10 @@ if("${CMAKE_FRAMEWORK}" STREQUAL "") FRAMEWORK TRUE) endif() set_target_properties(Framework PROPERTIES + MACOSX_FRAMEWORK_BUNDLE_NAME MyFrameworkBundleName + MACOSX_FRAMEWORK_BUNDLE_VERSION 3.2.1 + MACOSX_FRAMEWORK_SHORT_VERSION_STRING 3 + MACOSX_FRAMEWORK_IDENTIFIER MyFrameworkId PUBLIC_HEADER foo.h RESOURCE "res.txt") set_source_files_properties(flatresource.txt PROPERTIES MACOSX_PACKAGE_LOCATION Resources) diff --git a/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix-build-final-check.cmake b/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix-build-final-check.cmake index 76fe6b8..7a1d70e 100644 --- a/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix-build-final-check.cmake +++ b/Tests/RunCMake/Framework/FrameworkMultiConfigPostfix-build-final-check.cmake @@ -20,26 +20,32 @@ else() endif() if(NOT IS_DIRECTORY ${framework_dir}) - message(SEND_ERROR "Framework dir not found at ${framework_dir}") + set(RunCMake_TEST_FAILED "Framework dir not found at \n ${framework_dir}") + return() endif() if(IS_DIRECTORY ${non_existent_debug_framework_dir}) - message(SEND_ERROR - "A framework dir with a debug suffix should not exist at ${non_existent_debug_framework_dir}") + set(RunCMake_TEST_FAILED + "A framework dir with a debug suffix should not exist at \n ${non_existent_debug_framework_dir}") + return() endif() if(NOT IS_SYMLINK "${symlink_release_path}") - message(SEND_ERROR "Release framework symlink not found at ${symlink_release_path}") + set(RunCMake_TEST_FAILED "Release framework symlink not found at \n ${symlink_release_path}") + return() endif() if(NOT IS_SYMLINK "${symlink_debug_path}") - message(SEND_ERROR "Debug framework symlink not found at ${symlink_debug_path}") + set(RunCMake_TEST_FAILED "Debug framework symlink not found at \n ${symlink_debug_path}") + return() endif() if(NOT EXISTS "${framework_release_path}") - message(SEND_ERROR "Release framework not found at ${framework_release_path}") + set(RunCMake_TEST_FAILED "Release framework not found at \n ${framework_release_path}") + return() endif() if(NOT EXISTS "${framework_debug_path}") - message(SEND_ERROR "Debug framework not found at ${framework_debug_path}") + set(RunCMake_TEST_FAILED "Debug framework not found at \n ${framework_debug_path}") + return() endif() diff --git a/Tests/RunCMake/Framework/OSXFrameworkLayout-build-check.cmake b/Tests/RunCMake/Framework/OSXFrameworkLayout-build-check.cmake index eb71394..b436128 100644 --- a/Tests/RunCMake/Framework/OSXFrameworkLayout-build-check.cmake +++ b/Tests/RunCMake/Framework/OSXFrameworkLayout-build-check.cmake @@ -10,41 +10,53 @@ set(plist-file "${framework-resources}/Info.plist") set(framework-header "${framework-dir}/Headers/foo.h") if(NOT IS_DIRECTORY ${framework-dir}) - message(SEND_ERROR "Framework not found at ${framework-dir}") + set(RunCMake_TEST_FAILED "Framework not found at \n ${framework-dir}") + return() endif() if(NOT EXISTS ${plist-file}) - message(SEND_ERROR "plist file not found at ${plist-file}") + set(RunCMake_TEST_FAILED "plist file not found at \n ${plist-file}") + return() endif() if(NOT EXISTS ${framework-library}) - message(SEND_ERROR "Framework library not found at ${framework-library}") + set(RunCMake_TEST_FAILED "Framework library not found at \n ${framework-library}") + return() endif() if(NOT EXISTS ${framework-resource-file}) - message(SEND_ERROR "Framework resource file not found at ${framework-resource-file}") + set(RunCMake_TEST_FAILED "Framework resource file not found at \n ${framework-resource-file}") + return() endif() if(NOT EXISTS ${framework-flat-resource-file}) - message(SEND_ERROR "Framework flat resource file not found at ${framework-flat-resource-file}") + set(RunCMake_TEST_FAILED "Framework flat resource file not found at \n ${framework-flat-resource-file}") + return() endif() if(NOT EXISTS ${framework-deep-resource-file}) - message(SEND_ERROR "Framework deep resource file not found at ${framework-deep-resource-file}") + set(RunCMake_TEST_FAILED "Framework deep resource file not found at \n ${framework-deep-resource-file}") + return() endif() if(NOT EXISTS ${framework-some-file}) - message(SEND_ERROR "Framework some file not found at ${framework-some-file}") + set(RunCMake_TEST_FAILED "Framework some file not found at \n ${framework-some-file}") + return() endif() if(NOT EXISTS ${framework-versions}) - message(SEND_ERROR "Framework versions not found at ${framework-versions}") + set(RunCMake_TEST_FAILED "Framework versions not found at \n ${framework-versions}") + return() endif() if(NOT EXISTS ${framework-resources}) - message(SEND_ERROR "Framework Resources not found at ${framework-resources}") + set(RunCMake_TEST_FAILED "Framework Resources not found at \n ${framework-resources}") + return() endif() if(NOT EXISTS ${framework-header}) - message(SEND_ERROR "Framework header file not found at ${framework-header}") + set(RunCMake_TEST_FAILED "Framework header file not found at \n ${framework-header}") + return() endif() + +include(${CMAKE_CURRENT_LIST_DIR}/FrameworkLayout-check-common.cmake) diff --git a/Tests/RunCMake/Framework/iOSFrameworkLayout-build-check.cmake b/Tests/RunCMake/Framework/iOSFrameworkLayout-build-check.cmake index 2da60d2..be9a5fe 100644 --- a/Tests/RunCMake/Framework/iOSFrameworkLayout-build-check.cmake +++ b/Tests/RunCMake/Framework/iOSFrameworkLayout-build-check.cmake @@ -10,41 +10,53 @@ set(plist-file "${framework-dir}/Info.plist") set(framework-header "${framework-dir}/Headers/foo.h") if(NOT IS_DIRECTORY ${framework-dir}) - message(SEND_ERROR "Framework not found at ${framework-dir}") + set(RunCMake_TEST_FAILED "Framework not found at\n ${framework-dir}") + return() endif() if(NOT EXISTS ${plist-file}) - message(SEND_ERROR "plist file not found at ${plist-file}") + set(RunCMake_TEST_FAILED "plist file not found at\n ${plist-file}") + return() endif() if(NOT EXISTS ${framework-library}) - message(SEND_ERROR "Framework library not found at ${framework-library}") + set(RunCMake_TEST_FAILED "Framework library not found at\n ${framework-library}") + return() endif() if(NOT EXISTS ${framework-resource-file}) - message(SEND_ERROR "Framework resource file not found at ${framework-resource-file}") + set(RunCMake_TEST_FAILED "Framework resource file not found at\n ${framework-resource-file}") + return() endif() if(NOT EXISTS ${framework-flat-resource-file}) - message(SEND_ERROR "Framework flat resource file not found at ${framework-flat-resource-file}") + set(RunCMake_TEST_FAILED "Framework flat resource file not found at\n ${framework-flat-resource-file}") + return() endif() if(NOT EXISTS ${framework-deep-resource-file}) - message(SEND_ERROR "Framework deep resource file not found at ${framework-deep-resource-file}") + set(RunCMake_TEST_FAILED "Framework deep resource file not found at\n ${framework-deep-resource-file}") + return() endif() if(NOT EXISTS ${framework-some-file}) - message(SEND_ERROR "Framework some file not found at ${framework-some-file}") + set(RunCMake_TEST_FAILED "Framework some file not found at\n ${framework-some-file}") + return() endif() if(EXISTS ${framework-versions}) - message(SEND_ERROR "Framework versions found at ${framework-versions}") + set(RunCMake_TEST_FAILED "Framework versions found at\n ${framework-versions}") + return() endif() if(EXISTS ${framework-resources}) - message(SEND_ERROR "Framework Resources found at ${framework-resources}") + set(RunCMake_TEST_FAILED "Framework Resources found at\n ${framework-resources}") + return() endif() if(NOT EXISTS ${framework-header}) - message(SEND_ERROR "Framework headers not found at ${framework-header}") + set(RunCMake_TEST_FAILED "Framework headers not found at\n ${framework-header}") + return() endif() + +include(${CMAKE_CURRENT_LIST_DIR}/FrameworkLayout-check-common.cmake) |