From 10baaa420be1cb525cd04da0ccbad80b3b8b9ea1 Mon Sep 17 00:00:00 2001 From: reuk Date: Wed, 25 Jan 2023 13:14:31 +0000 Subject: [PATCH] CMake: Warn if bundle ID contains spaces --- docs/CMake API.md | 2 +- extras/Build/CMake/JUCEUtils.cmake | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/CMake API.md b/docs/CMake API.md index 059c73ab7d..dbf16b56d6 100644 --- a/docs/CMake API.md +++ b/docs/CMake API.md @@ -266,7 +266,7 @@ attributes directly to these creation functions, rather than adding them later. `BUNDLE_ID` - An identifier string in the form "com.yourcompany.productname" which should uniquely identify this target. Mainly used for macOS builds. If not specified, a default will be generated using - the target's `COMPANY_NAME` and `PRODUCT_NAME`. + the target's `COMPANY_NAME` and the name of the CMake target. `MICROPHONE_PERMISSION_ENABLED` - May be either TRUE or FALSE. Adds the appropriate entries to an app's Info.plist. diff --git a/extras/Build/CMake/JUCEUtils.cmake b/extras/Build/CMake/JUCEUtils.cmake index 90f59fbf90..b86e0b4547 100644 --- a/extras/Build/CMake/JUCEUtils.cmake +++ b/extras/Build/CMake/JUCEUtils.cmake @@ -1297,6 +1297,12 @@ function(_juce_set_fallback_properties target) get_target_property(real_company_name ${target} JUCE_COMPANY_NAME) _juce_set_property_if_not_set(${target} BUNDLE_ID "com.${real_company_name}.${target}") + get_target_property(applied_bundle_id ${target} JUCE_BUNDLE_ID) + + if("${applied_bundle_id}" MATCHES ".* .*") + message(WARNING "Target ${target} has JUCE_BUNDLE_ID '${applied_bundle_id}', which contains spaces. Use the BUNDLE_ID option to specify a valid ID.") + endif() + _juce_set_property_if_not_set(${target} VERSION ${PROJECT_VERSION}) get_target_property(final_version ${target} JUCE_VERSION)