JuceHeader.h with cmake and vscode issues

Hey everyone, forgive me if this is both in the wrong forum and/or a total n00b question, but I can’t seem to find an answer anywhere.

I’m coming back to a project I started months ago, which I’m using both CMake and VSCode, as the title says. I’ve previously been including headers “manually” (ie. #include <juce_audio_processors/juce_audio_processors.h> in the relevant headers, etc), but I started building a preset manager in which it would make sense to use the JuceHeader.h because of the projectName and companyName constants.

For my CMakeLists.txt, I’d copied this example and adjusted it for my purposes and uncommented the juce_generate_juce_header(AudioPluginExample) line. Just above said line, it explains that the JuceHeader should be included simply by #include <JuceHeader.h>, but if I do so, I get include errors.

I noticed that CMake did indeed generate the JuceHeader, which is tucked into my build/[PluginName]_artefacts/JuceLibraryCode/ folder.

While we’re here, I also noticed that VSCode intellisense doesn’t seem to realize the “settings” defined by CMakeLists.txt. For instance, I’ve set IS_MIDI_EFFECT as true, but that doesn’t seem to be reflected in the highlighting.
Also, slightly unrelated, I’d like to set DONT_SET_USING_JUCE_NAMESPACE, where is the correct place to do so?

Did you change the token AudioPluginExample to match the real name of your plugin target?

Do you see the include errors when you build, or just in Intellisense? I would expect the build to work, even if Intellisense doesn’t pick up the new include path immediately.

You can add that to the target_compile_definitions for the target created by juce_add_plugin.

And for the Intellisense, you can try adding a ‘forcedInclude’. I think it can pick up the definitions from the header that way. Check out the reference here: