CMake examples in Xcode

Followup on cleaning up the IDE presentation.

In the end I took an approach similar to what Tracktion’s pluginval does and have a more usable IDE-friendly xcode build with:

set(SourceFiles
	Source/PluginEditor.h
	Source/PluginProcessor.h
	Source/PluginEditor.cpp
	Source/PluginProcessor.cpp)

target_sources(Pamplejuce PRIVATE ${SourceFiles})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/Source PREFIX Source FILES ${SourceFiles})

This still felt pretty messy, so I’ve manually moved all the other targets into a folder called “Targets”:

# https://cliutils.gitlab.io/modern-cmake/chapters/features/ides.html
set_property(TARGET Pamplejuce_AU PROPERTY FOLDER "Targets")
set_property(TARGET Pamplejuce_AUv3 PROPERTY FOLDER "Targets")
set_property(TARGET Pamplejuce_VST3 PROPERTY FOLDER "Targets")
set_property(TARGET Pamplejuce_All PROPERTY FOLDER "Targets")
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "Targets")
set(CMAKE_SUPPRESS_REGENERATION true) # No ZERO_CHECK

I did this manually because set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "Targets") doesn’t seem to work (or is maybe overridden by JUCEUtils.cmake)?

Looking better:

Next up I plan on looking into:

  1. Consolidating/nesting/removing the “Source Files” and “Header Files” directories. These seem to be default cmake groupings but I haven’t figured out if it would require changes to JUCEUtils.cmake
  2. Setting some scheme options by default, for example having the AudioPluginHost being the executable: https://cmake.org/cmake/help/latest/prop_tgt/XCODE_GENERATE_SCHEME.html
  3. Figuring out if I can remove the module schemes that get added when JUCE_ENABLE_MODULE_SOURCE_GROUPS is on.
1 Like