Hi!
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.
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).
So, I suggest adding a INTERFACE_LINK_OPTIONS target property. That way I
would add the library using:
add_library(the_library.lib STATIC IMPORTED)
set_property(TARGET the_library.lib
PROPERTY INTERFACE_LINK_OPTIONS
$<$<CONFIG:Debug>:/NODEFAULTLIB:libcmt>)
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.
(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.)
Sincerely,
Anders Lindgren
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake