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 | |
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
9 files changed, 102 insertions, 27 deletions
diff --git a/Help/prop_tgt/MACOSX_FRAMEWORK_INFO_PLIST.rst b/Help/prop_tgt/MACOSX_FRAMEWORK_INFO_PLIST.rst index 82fdcc0..a1f7c66 100644 --- a/Help/prop_tgt/MACOSX_FRAMEWORK_INFO_PLIST.rst +++ b/Help/prop_tgt/MACOSX_FRAMEWORK_INFO_PLIST.rst @@ -12,12 +12,20 @@ file name which may be a full path. The following target properties may be set to specify content to be configured into the file: +``MACOSX_FRAMEWORK_BUNDLE_NAME`` + .. versionadded:: 3.31 + + Sets ``CFBundleName``. + ``MACOSX_FRAMEWORK_BUNDLE_VERSION`` Sets ``CFBundleVersion``. + ``MACOSX_FRAMEWORK_ICON_FILE`` Sets ``CFBundleIconFile``. + ``MACOSX_FRAMEWORK_IDENTIFIER`` Sets ``CFBundleIdentifier``. + ``MACOSX_FRAMEWORK_SHORT_VERSION_STRING`` Sets ``CFBundleShortVersionString``. diff --git a/Help/release/dev/apple-framework-bundle-name.rst b/Help/release/dev/apple-framework-bundle-name.rst new file mode 100644 index 0000000..541845b --- /dev/null +++ b/Help/release/dev/apple-framework-bundle-name.rst @@ -0,0 +1,6 @@ +apple-framework-bundle-name +--------------------------- + +* The :prop_tgt:`MACOSX_FRAMEWORK_BUNDLE_NAME <MACOSX_FRAMEWORK_INFO_PLIST>` + target property was added to set the ``CFBundleName`` key in an Apple + :prop_tgt:`FRAMEWORK`'s ``Info.plist`` file. diff --git a/Modules/MacOSXFrameworkInfo.plist.in b/Modules/MacOSXFrameworkInfo.plist.in index 18eaef2..f053fda 100644 --- a/Modules/MacOSXFrameworkInfo.plist.in +++ b/Modules/MacOSXFrameworkInfo.plist.in @@ -12,6 +12,8 @@ <string>${MACOSX_FRAMEWORK_IDENTIFIER}</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> + <key>CFBundleName</key> + <string>${MACOSX_FRAMEWORK_BUNDLE_NAME}</string> <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleSignature</key> diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 94e62ff..aa3f28e 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -4369,6 +4369,7 @@ void cmLocalGenerator::GenerateFrameworkInfoPList( cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_ICON_FILE"); cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_IDENTIFIER"); cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_SHORT_VERSION_STRING"); + cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_BUNDLE_NAME"); cmLGInfoProp(mf, target, "MACOSX_FRAMEWORK_BUNDLE_VERSION"); mf->ConfigureFile(inFile, fname, false, false, false); } 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) |