Turning on linker flags with CMake

后端 未结 5 1259
萌比男神i
萌比男神i 2020-12-30 00:37

When generating VS2010 targets with CMake, I would like the /LTCG flag turned on (only for release + releasewithdebinfo if possible, but its okay if its on for debug builds)

5条回答
  •  感动是毒
    2020-12-30 01:30

    You can add linker flags for a specific target using the LINK_FLAGS property:

    set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " ${flag}")
    

    (note that I added a space before the flag since I'm using APPEND_STRING)

提交回复
热议问题