CMake: Icon file not generated

Hey JUCE-team,

I’m adding an icon file with

juce_add_gui_app(MyApp
        ...
        ICON_BIG "Icon.png")

but it doesn’t work with a macOS app.

The icon file seems to be found by the juceaide generator, because if I put in a wrong path, it complains.

I can see a generated Icon file in MyApp_artefacts/JuceLibraryCode/Icon.icns, but only once I executed a build in XCode. Seems like the icon file is generated from the XCode build, not by Cmake.

The Info.plist contains a property Icon File, but that is empty on CMake generation, probably because the generated icns file couldn’t yet be found. Only once I execute a full build in XCode, that generates the icns file and then manually rerun CMake, this property gets filled and the icon works.

Johannes

Are you using the very latest develop? If not, please check out the current develop and see whether that solves the issue. I fixed some issues related to mac icons at the beginning of July, just after the 6.0.1 release.

You could also try using an absolute path to the icon ("${CMAKE_CURRENT_SOURCE_DIR}/Icon.png"), as we do in the CMakeLists for the example JUCE projects.

I just tried generating a build for the JUCE repo like so, from develop:

cmake -B cmake-build-xcode -G Xcode -D JUCE_BUILD_EXTRAS=ON

Now, before building, I can find valid icon files for the JUCE targets (e.g. extras/AudioPluginHost/AudioPluginHost_artefacts/JuceLibraryCode/Icon.icns). The plist for the AudioPluginHost also correctly references Icon.icns.

Hey @reuk,

thanks for the quick reply! Yes, switching to develop does fix the problem! The icns file is generated instantly. Thanks! Any hint when it’ll be merged onto master?

Johannes

We are also running into this… We’d like to use the fix, but would rather stay in the master branch for stability reasons. How often do merges to master typically happen?

1 Like