How can I specify C++ version from PIP?

I’m making a simple local CI system which is driven by PowerShell.
I need to make unit test projects from PIP by Projucer’s command line mode.
My module uses C++17…so, I assume that I have to declare C++ version in the JUCE_PIP_METADATA.
Is that right? If so, what is the magic word?

I did a very simple customization.
I added these two line to PIPGenerator::setProjectSettings(ValueTree&).

static const Identifier cppver = "cppversion";
setPropertyIfNotEmpty(Ids::cppLanguageStandard, metadata[cppver]);

and my PIP metadata looks like…

BEGIN_JUCE_PIP_METADATA

name:            myUnitTest
cppversion:      17
//...

END_JUCE_PIP_METADATA

And build my custom Projucer, and run it from my script.
It works for now.
Let me know if I’m going totally wrong direction, or you notice any pitfalls.

I think you are on the right track, and I guess there are a few other project settings that could be supported in the same way.

Nitpicking, instead of cppversion, I would use cppStandard, to match the minimumCppStandard value that can be specified by JUCE modules (for instance, juce_dsp).

1 Like

OK! Thanks for your reply.

It didn’t occur to me until you said minimumCppStandard, but should I declare minimumCppStandard: 17 between BEGIN_JUCE_MODULE_DECLARATION and END_JUCE_MODULE_DECLARATION?
It will be more easy and I won’t need to change Projucer’s source code every time I update JUCE.

No, Projucer looks for BEGIN_JUCE_MODULE_DECLARATION and END_JUCE_MODULE_DECLARATION in the main header of each JUCE module, not in PIP files.

1 Like