Linux juce6 cmake with NEEDS_WEB_BROWSER


JUCE6 is great. I found an issue today on Linux using it where NEEDS_WEB_BROWSER FALSE sets the build in an inconsistent state. Since my forum was not working this morning (and is sitll not working on safari on mac - not sure why - but hi from Chrome!) I wrote it up as a github issue

but I also see that you would rather discuss things on the forum than github so adding it here now I have my foruming working.

Short version is: if you set NEEDS_WEB_BROWSER to FALSE the linux also needs to define JUCE_WEB_BROWSER=0 in the compile flags, so I needed to add an else() in the cmake utils (or add both the NEEDS to false and the define to false in my cmake). Not sure that my fix is right but wanted to add it here in case I missed something.



    • On Linux, JUCE may or may not need to link to Webkit depending on the compile definitions that are set on a JUCE target. By default, we don’t link Webkit because you might not need it, but if you get linker or include errors that reference Webkit, just set this argument to TRUE.

This means that NEEDS_WEB_BROWSER is only here to control whether you want to link against WebKit. It doesn’t have any effect on the preprocessor defines.

You are supposed to write target_compile_definitions(<target> PRIVATE JUCE_WEB_BROWSER=0) in your CMakeLists.txt, as shown in:

I hope this helps!

Yeah i did that and got it to build sure! And like I said on the issue, I’m super excited by JUCE6.

The thing I noticed was that - since those two settings either need to be TRUE or FALSE/=0 (there is no world where TRUE/=0 or FALSE/=1 makes sense) you could instead just make it so one of them toggled the other so you couldn’t write an inconsistent CMakeLists.txt in this regard.

For libcurl, there is the following situation:

target_compile_definitions(<target> PRIVATE

to load symbols at runtime instead of linking against libcurl.

1 Like

Ahh cool. OK I’ll close my github issue then! Thanks

I don’t understand much about CURL, but perhaps all these flags could be summed into one macro that isn’t a boolean? Kinda like 0/1/2 , which will translate to None/Static/Dynamic?

That idea was what I was getting at by having needs blah set the juce use blah yeah but it does seem there’s more modes than i had thought

(My problem came up because only Linux breaks if you set needs web to false and don’t set juce use web to 0)