Skip to content

Instantly share code, notes, and snippets.

@amirmasoudabdol
Last active May 25, 2023 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amirmasoudabdol/4348cb19eacfdb96da58f01c183ec65f to your computer and use it in GitHub Desktop.
Save amirmasoudabdol/4348cb19eacfdb96da58f01c183ec65f to your computer and use it in GitHub Desktop.
bundle.cmake
if(is_cmake_bundle_identifier_given
AND is_xcode_bundle_identifier_given
AND NOT existing_cmake_bundle_identifier STREQUAL existing_xcode_bundle_identifier)
message(WARNING
"MACOSX_BUNDLE_GUI_IDENTIFIER and XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "
"are set to different values. You only need to set one of them. "
"Use 'MACOSX_BUNDLE_GUI_IDENTIFIER' for maximum compatibility. ")
endif()
if(NOT is_xcode_bundle_identifier_given
AND NOT is_cmake_bundle_identifier_given)
_qt_internal_get_default_apple_bundle_identifier("${target}" bundle_id)
message(STATUS "Generated Bundle Identifier: ${bundle_id}")
elseif(is_cmake_bundle_identifier_given)
set(bundle_id ${existing_cmake_bundle_identifier})
elseif(is_xcode_bundle_identifier_given)
set(bundle_id ${existing_xcode_bundle_identifier})
endif()
if(CMAKE_GENERATOR STREQUAL "Xcode")
set_target_properties("${target}"
PROPERTIES
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${bundle_id}"
MACOSX_BUNDLE_GUI_IDENTIFIER "\${PRODUCT_BUNDLE_IDENTIFIER}")
else()
set_target_properties("${target}"
PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER "${bundle_id}")
endif()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment