There was already a Thread which did not help really. I want to be able to link for example Foo.lib for Release Config and Foo_d.l
If you have debug/release libs that follow a certain pattern, like _d on the debug ones, you can avoid repeating yourself with:
set (MY_LIBS
foo
bar
baz
)
# Generate the list of files to link, per flavor.
set (LINK_LIST "")
foreach(x ${MY_LIBS})
list (APPEND LINK_LIST debug ${x}_d optimized ${x})
endforeach()
target_link_libraries (mytarget
commonlib1
commonlib2
${LINK_LIST}
)
This will generate the appropriate
debug foo_d optimized foo
debug bar_d optimized bar
lines that target_link_libraries expects.