# add\_library(Target $\<$CONFIG:DebugEditor\>:SHARED "") error

**URL:** <https://discourse.cmake.org/t/add-library-target-config-debugeditor-shared-error/8126>\
**Category:** Code\
**Tags:** os:windows, gen:vs\
**Created:** [May 15, 2023, 5:10am UTC](https://discourse.cmake.org/t/add-library-target-config-debugeditor-shared-error/8126 "2023-05-15T05:10:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aidexie](https://discourse.cmake.org/user_avatar/discourse.cmake.org/aidexie/32/3439_2.png) [@aidexie](https://discourse.cmake.org/u/aidexie)\
**Post date:** [May 15, 2023, 5:10am UTC](https://discourse.cmake.org/t/add-library-target-config-debugeditor-shared-error/8126/1 "2023-05-15T05:10:56Z")

</div>

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\> “”)

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [May 15, 2023, 10:10am UTC](https://discourse.cmake.org/t/add-library-target-config-debugeditor-shared-error/8126/2 "2023-05-15T10:10:16Z")

</div>

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).
