Ninja Multi-Config: Per-config inter-target dependencies
Config related generator expression used in "target_link_libraries()" command seems not addressed correctly when the generator is "Ninja Multi-Config".
For example,
cmake_minimum_required(VERSION 3.20)
project("example")
add_library(libA STATIC a.cpp)
add_library(libB SHARED b.cpp)
target_link_libraries(
libB PRIVATE
$<$<CONFIG:Debug>:libA>
)
with the CMakePresets.json:
{
...
"name": "default",
"generator": "Ninja Multi-Config",
"cacheVariables": {
"CMAKE_CONFIGURATION_TYPES": "Debug;Release"
}
...
}
when build Release with command:
cmake --build <path/to/bindir> --target libB --config Release
libA is also built and linked to by libB, which should not happen. However, if "Visual Studio 16 2019" is used as the generator, libA is not built as expeted.