In my plugin I want Debug and Debug_Editor. This was easy to do with Projucer, any idea how to do in CMake? I’m trying:
set(CMAKE_CONFIGURATION_TYPES Debug Release Debug_Editor Release_Editor)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Reset the configurations to what we need" FORCE)
set (CMAKE_C_FLAGS_DEBUG_EDITOR ${CMAKE_C_FLAGS_DEBUG})
set (CMAKE_CXX_FLAGS_DEBUG_EDITOR ${CMAKE_CXX_FLAGS_DEBUG})
However, in Xcode and Visual Studio, NDEBUG and _NDEBUG are still defined for Debug_Editor.
You’re right that it’s an error for JUCE to assume the debug config is always just Debug, but CMake already has a property for this built in, I advise against adding a JUCE-specific property/variable for this.
IMHO the correct way to handle this is:
JUCE should check the value of the DEBUG_CONFIGURATIONS global property
You should set that property in your CMakeLists.txt before adding JUCE
The multi-argument form of $<CONFIG> isn’t supported in JUCE’s minimum-required CMake (3.15). I’ve got a patch on the way that should work for all of the CMake versions we support.
Not necessarily, but at the same time we don’t want to set an arbitrarily high usage requirement. As long as the burden for supporting an older version is reasonable (and for the most part, CMake 3.15 is usable), there’s not much reason to move.
I’m not sure, but it’s possible people have other sorts of builds beyond just debug and release. Making all non-debug builds fully optimised seems a bit surprising.
I think the intention of CMake’s global DEBUG_CONFIGURATIONS property is that all configurations not listed there are for release purposes. Using $<CONFIG:Release> doesn’t even cover all of CMake’s built-in configurations, since it leaves out MinSizeRel and RelWithDebInfo.