add_library(Target $<$CONFIG:DebugEditor>:SHARED "") error

On windows platform we use cmake to generate VS projects, which have a total of 4 configuration modes: Debug, DebugEditor, Release, ReleaseEditor. now we have a new requirement, some modules are compiled as static libraries in Debug, Release mode, and as dynamic libraries in DebugEditor , ReleaseEditor mode as dynamic libraries.
I’m using the following to set this up, but cmake can’t resolve it
add_library(Target $<$CONFIG:Debug>:STATIC> “”)
add_library(Target $<$CONFIG:DebugEditor>:SHARED> “”)

That argument to add_library does not support generator expressions. There’s no way to make a single target a different library type between configurations in a multi-config generator (such as Visual Studio); you’ll need to make two targets and select between them using generator expressions in the target_link_libraries calls (potentially made easier by an INTERFACE target that does this that can then be used directly).

1 Like