Clark Gaebel Clark Gaebel - 1 year ago 144
C Question

Turning on linker flags with CMake

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). How do I modify the linker flags?

doesn't work because that only modifies compiler flags. And yes, I have wrapped it in if(MSVC).

How do I modify the linker flags?

Answer Source

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:


(Thanks to

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download