set_target_properties(target PROPERTIES LINK_FLAGS "/OPT:NOREF") should work.

Am 13/02/2018 um 14:38 schrieb ThePhD:
I have a project where I attempt to add linker flags to a Visual Studio project using

     target_link_libraries(lib_target PRIVATE /OPT:NOREF)

But it seems like the `/` syntax automatically has CMake assuming that the flag is a file, and it complains it cannot find the file. Is there any way to have CMake recognize a passed-in linker flag using this syntax? As a side note, is there perhaps a better way of passing in Linker flags that I am not aware of? Documentation stated that using "target_link_libraries" is preferred, and I did not find "target_link_options".



Powered by

Please keep messages on-topic and check the CMake FAQ at:

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe:

Reply via email to