Custom JUCE modules not being added to JuceHeader.h with cmake

My custom JUCE modules are not being added to JuceHeader.h with cmake.

I’m calling juce_add_modules(folder/module_name)

And this is definitely calling juce_add_module

But how does it get from there into the JuceHeader file? I can’t pin down what to check next!

edit: I guess this is a clue…


# We use the target preprocessor definitions to work out which JUCE modules should go in the JuceHeader.h.

It’s improbably hard to debug because it just prints a generator expression when i try and probe with ‘message’

Have you definitely linked your module to your target with target_link_libraries?


Yeah - even if i put it in manually, e.g. jcf_lime_juce here it doesn’t work.

adding .....
adding juce_analytics
adding module juce_analytics
module_header name juce_analytics.h
adding juce_audio_basics
adding module juce_audio_basics
module_header name juce_audio_basics.h
adding juce_audio_devices
adding module juce_audio_devices
module_header name juce_audio_devices.h
adding juce_audio_formats
adding module juce_audio_formats
module_header name juce_audio_formats.h
adding juce_audio_plugin_client
adding module juce_audio_plugin_client
module_header name juce_audio_plugin_client.h
adding juce_audio_processors
adding module juce_audio_processors
module_header name juce_audio_processors.h
adding juce_audio_utils
adding module juce_audio_utils
module_header name juce_audio_utils.h
adding juce_box2d
adding module juce_box2d
module_header name juce_box2d.h
adding juce_core
adding module juce_core
module_header name juce_core.h
adding juce_cryptography
adding module juce_cryptography
module_header name juce_cryptography.h
adding juce_data_structures
adding module juce_data_structures
module_header name juce_data_structures.h
adding juce_dsp
adding module juce_dsp
module_header name juce_dsp.h
adding juce_events
adding module juce_events
module_header name juce_events.h
adding juce_graphics
adding module juce_graphics
module_header name juce_graphics.h
adding juce_gui_basics
adding module juce_gui_basics
module_header name juce_gui_basics.h
adding juce_gui_extra
adding module juce_gui_extra
module_header name juce_gui_extra.h
adding juce_opengl
adding module juce_opengl
module_header name juce_opengl.h
adding juce_osc
adding module juce_osc
module_header name juce_osc.h
adding juce_product_unlocking
adding module juce_product_unlocking
module_header name juce_product_unlocking.h
adding juce_video
adding module juce_video
module_header name juce_video.h
adding module juce_build_tools
module_header name juce_build_tools.h
-- Configuring juceaide
-- Building juceaide
-- Exporting juceaide
adding .....
adding gadgets/jcf_cranberry_juce
adding module gadgets/jcf_cranberry_juce
module_header name jcf_cranberry_juce.h
adding gadgets/jcf_lime_juce
adding module gadgets/jcf_lime_juce
module_header name jcf_lime_juce.h
adding gadgets/jcf_plugin_magic
adding module gadgets/jcf_plugin_magic
module_header name jcf_plugin_magic.h
adding gadgets/dm_plugin_framework
adding module gadgets/dm_plugin_framework
module_header name dm_plugin_framework.h
$<FILTER:$<TARGET_GENEX_EVAL:DVolume,$<TARGET_PROPERTY:DVolume,COMPILE_DEFINITIONS>>,EXCLUDE,JucePlugin_Build_|JUCE_SHARED_CODE> xxx 
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/jim/Code/DVolume/cmake-build-debug

[Finished]

Here’s the output of my message statements, you can see module header name is being set…

I don’t think a library name can contain a slash. The module name is just the name of the module’s folder, and must be globally unique.

Perhaps CMake isn’t regenerating the header after adding a module. You could try deleting the header from your build tree at targetName/targetName_artefacts/JuceLibraryCode/JuceHeader.h and reconfiguring.

Hang on! Is the header generated during the build or the configure stage? :slight_smile:

Because when I make an Xcode project I don’t seem to get the JuceHeader.h at all - maybe my basic understanding of CMake is wrong!

Sorry, I was misremembering - the header is written during the build, but it depends on a data file which is written at generate time. This file lives at the target’s JuceLibraryCode/<configuration>/Defs.txt.

You could try removing the JuceHeader and the Defs.txt - or just remove the build tree completely and see if that helps.

Ok - I was testing this wrong. So I had two problems, I think one is the slash and the other is a poor understanding of when JuceHeader.h is created. I was anticipating the generate stage as delivering the actual header file … generating new source at build time is slightly weird :wink:

Ok - up and running - thank you for the prompt help!