Turning on linker flags with CMake

后端 未结 5 1227
萌比男神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:17

    You can modify the linker flags in MSC using #pragma comment(linker, ...)

    However, if you'd like to do it in the build process with cmake, here are the names you need to know:

    • CMAKE_EXE_LINKER_FLAGS
    • CMAKE_SHARED_LINKER_FLAGS
    • CMAKE_MODULE_LINKER_FLAGS

    (Thanks to Cmake.org).

提交回复
热议问题