CMake Noise Xcode

I’ve finally bitten the bullet and started combining large amounts of Projucer projects into a single Meta Xcode project – so far it’s going great, however, in a lot of ways I’m missing Projucer.

There’s a handful of irritations, and I’m guessing this isn’t bothering others as they’re perhaps not even using Xcode at all anymore now that CMake is in the mix.

Differences from Projucer:

  • App Icons Don’t Display In Xcode
  • Tons of Worthless Folders & Files CMake Rules, CMakeLists etc
  • Target names changed from tidy “Plugin - Target” to “Plugin_Target” & Everything is a mess in one flat folder

Overall the benefits far outweigh the cons such as compiling various projects using shared code in a single place, tests, standalone app + plugins in one place etc etc – it’s totally awesome, especially the binary data dependency management and a host of other amazing features.

I’m wondering though – is there a place I could further modify how the projects are generated to perhaps not include the cmake files in the file trees. source_group has been a massive help, but I haven’t found a way to just hide / remove things I don’t want to see.

Anyone else using Xcode + CMake and have managed to get the Xcode projects back to ~vibes~ the projucer was giving us?

Not sure if helpful to anyone else – but to anyone wanting to do some extra cleanup, after yanking my hair out for a couple days with CMake – this has been much nicer to use:

Allowing things such as:

require 'xcodeproj'

project ='Project.xcodeproj')

# Delete Unwanted Targets
project.targets.delete( { |target| == 'ZERO_CHECK' }.first) rescue ""
project.targets.delete( { |target| == 'install' }.first) rescue ""

# Remove CMakeLists Files
project.files.each do |file|
  if == "CMakeLists.txt"

etc etc etc

The ZERO_CHECK target is set as dependency to all other targets by Cmake. Its job is to run before anything else and to re-generate the project if any cmake file has changed since the last build. As someone that uses cmake, this is something I expect to work. It make it easy to edit cmake files directly in your IDE, then click build and everything will be in order.

However I this is not a behaviour you want (and are OK re-running cmake manually when needed), there is a “proper” way of disabling it: c++ - What are ALL_BUILD and ZERO_CHECK and do I need them? - Stack Overflow

As per the install target, if you never call install() in your cmake files it will not exist. install — CMake 3.23.0-rc5 Documentation

I personally find that this install is one of the great features of CMake. It makes sure the product of your build end up in a known predefined place, which does not depend on the generator you use (makefiles, ninja, Xcode, visual studio, whatever…). This makes packaging scripts, CI, etc… simpler to write, and for new developers it makes it very clear what the project is actually producing.

Hey @op414 – thanks for giving some context to that stuff I read a bit about it.

I see the calls to install() in the JUCE CMake code, but I’m not positive how it’s relevant to the plugin projects as we have the copy after build steps for each target – so it seemed it wasn’t actually used here? Unless I don’t understand what’s it doing, perhaps I can run it a few more time and see the benefit.

In CI I have scripts which copy the target back out from the copy locations, but it would be nice if calling this target I could have it build_all and then place them into the correct directory for signing and packaging.

In terms of the CMakeLists etc in Xcode the main reason is that Xcode doesn’t have syntax highlighting for CMake so when I’m editing the CMake files I’m using VS Code separately before generating the projects.

Overall I’ve got my project setup in a really nice fashion I’m happy with – the last two things I’ve not been able to accomplish to make my perfect setup is to sort the targets in an Alpha format so the dropdown for builds is clean when there are a lot of targets in the project (many apps) – and then displaying the icon of that app next to the target, when I get those thing – this will feel :sunglasses: