Cmake: Names with spaces

If I set Project(“FancyPants X6”) with a space in it I get an error:

CMake Error at swag/juce/extras/Build/CMake/JUCEUtils.cmake:1764 (add_library):
The target name “FancyPants X6” is reserved or not valid for certain CMake
features, such as generator expressions, and may result in undefined
behavior.

Is it impossible to make a project with a space in the name, and if so how do we set it up so our plugins binaries have a space in the name?

1 Like

Ah - maybe it’ s the PRODUCT_NAME juce thingi I think.

I’ve been meaning to check if a product name with spaces causes problems for Mac’s bundle ID. You might want to get there before me!

I’m having all kinds of weird issues. Ihe CFBundleIdentifier in the Info.plist is missing the product name entirely. My Projucer based plugin looks like :sli

<key>CFBundleIdentifier</key>
<string>com.deviousmachines.infiltrator</string>

But my cmake based on is:

    <key>CFBundleIdentifier</key>
    <string>com.deviousmachines.pkg</string>

Though apparently this is nothing to do with spaces as it’s happening to all my cmake projects at the mo!

Very curious to know how this can be resolved, came acropper with the same issue and couldn’t figure it out so just went with CamelCasePluginName, which kind of sucks.

The way this is supposed to work is that the output name is taken from PRODUCT_NAME. I’m pretty sure this bit works as expected - the AudioPluginExample generates bundles named Audio Plugin Example.ext.

In the CMake API docs, the bundle ID is supposed to be derived from the company name and PRODUCT_NAME, although it looks like in reality it’s derived from the company name and CMake target name. I’ll update the docs (changing behaviour seems a bit dangerous in this case!). If you’re not happy with the generated ID, you can specify a completely custom one, using the BUNDLE_ID option. It’s probably a good idea to avoid spaces in the ID, so if your product/company name contains spaces, I’d recommend setting a BUNDLE_ID with no spaces.

1 Like

CMake builds will now warn if the bundle ID contains spaces:

2 Likes