I would like to link to certain libraries only in Debug builds, not in Release ones. Using the debug flag in target_link_libraries as mentioned here only applies to the library immediately following the flag. However, I would like to apply it to all libraries specified in a variable from find_package, like so:
find_package(Cairomm)
add_library(Paint Painter.cpp)
target_link_libraries(Paint
debug ${Cairomm_LIBRARIES}
Checking the resulting binary with ldd shows, that the first library specified in Cairomm_LIBRARIES is indeed omitted, the following however are linked.
Can I somehow apply the debug flag to all libraries in the variable?