<div dir="ltr">Hi!<div><br></div><div><div>I have a third party-library only available in Release flavor. When building a Debug configuration, I need to pass the option /NODEFAULTLIB:libcmt to the Visual Studio linker.</div>
</div><div><br></div><div>I have been playing around with the new target interface system. However, I'm missing a way for a library to specify linker options, that would transitively affect targets that use the library (just like the INTERFACE_COMPILE_OPTIONS and INTERFACE_LINK_LIBRARIES do for compiler options and libraries, respectively).</div>
<div><br></div><div>So, I suggest adding a INTERFACE_LINK_OPTIONS target property. That way I would add the library using:<br></div><div><br></div><div>    add_library(the_library.lib STATIC IMPORTED)</div><div>    set_property(TARGET the_library.lib</div>
<div>      PROPERTY INTERFACE_LINK_OPTIONS $<$<CONFIG:Debug>:/NODEFAULTLIB:libcmt>)</div><div><br></div><div>In addition, there are two properties, COMPILE_FLAGS and COMPILE_OPTIONS, with the difference that the latter understands generator expressions. I also suggest adding a LINK_OPTIONS along the same lines.</div>
<div><br></div><div><div>(Note that the INTERFACE_LINK_LIBRARIES property is designed to contain both libraries and linker options. However, an entry is only interpreted as an option if it starts with a "-", which is not the case for Visual Studio options.)</div>
</div><div><br></div><div>Sincerely,</div><div>    Anders Lindgren</div><div><br></div></div>