Steve
Steve

Reputation: 187

Setting specific compile flags for projects in CMake

I've managed to edit link flags for specific projects using:

SET_TARGET_PROPERTIES(${target} PROPERTIES LINK_FLAGS "/foo") 

but I can't seem to edit the compiler flags using:

SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_FLAGS "/bar")

On opening the Visual Studio project I can't find "/bar" under the command line options. I have tried replacing "/bar" with a real flag but I can't see any changes happening under the C/C++ configuration properties.

Upvotes: 2

Views: 1573

Answers (1)

Steve
Steve

Reputation: 187

It turns out I need to move these functions after adding the executable to CMake

Upvotes: 5

Related Questions