[cmake-developers] COMPILE_OPTIONS or COMPILE_FLAGS

Brad King brad.king at kitware.com
Tue May 1 09:13:48 EDT 2018


On 05/01/2018 06:33 AM, Harry Mallon wrote:
> I just noticed that COMPILE_OPTIONS is 3.11.0 only. I can’t understand
> from the docs which of COMPILE_OPTIONS or COMPILE_FLAGS is preferred
> and why I might use one or the other.

COMPILE_OPTIONS for targets has existed for a long time.  What is
new in 3.11 is COMPILE_OPTIONS for source files.  COMPILE_FLAGS
has existed for source files for a long time too.

The difference is that COMPILE_FLAGS takes a command-line string
of flags that requires manual escaping.  COMPILE_OPTIONS takes a
;-list of flags and will do the escaping automatically.

The docs of the two options should be updated to mention each other
and make the distinction clear.

-Brad


More information about the cmake-developers mailing list