Note that cmake 3.8 added exactly what you want to generator expressions …
$<IF:?,true-value...,false-value...>
true-value... if ? is 1, false-value... if ? is 0
Example usage:
target_link_libraries(MyLib PUBLIC
$<IF:$<CONFIG:Debug>,cppzmq,cppzmq-static>
)
Where cppzmq is shared library used in Debug build and cppzmq-static is static library used in other case e.g. Release