Discussion:
[cmake-developers] COMPILE_OPTIONS or COMPILE_FLAGS
Harry Mallon
2018-05-01 10:33:45 UTC
Permalink
Hi all,

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. I will use COMPILE_FLAGS as it is supported on 3.10 (which we have on our linux build machine) for now.

I am specifically talking about adding “-mavx” to one file in particular but would prefer a general answer if anyone knows.

Thanks,
Harry

Harry Mallon

Senior Software Engineer

[http://codex.online/?action=asset&id=E3D62C3D-A12C-447D-87A5-F36E7C2AA9A4]<https://codex.online/>

T +44 203 7000 989<callto:+44%20203%207000%20989>

60 Poland Street | London | England | W1F 7NT

[http://codex.online/?action=asset&id=6F42BDF2-3C6D-4054-A5D2-277E0E535942]
Three Billboards Blade Runner 2049 I, Tonya
Brad King
2018-05-01 13:13:48 UTC
Permalink
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
--
Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/c
Harry Mallon
2018-05-01 13:40:49 UTC
Permalink
Thanks Brad,

I think I can use FLAGS for now then, but if my requirements get more complicated I'll use OPTIONS and require 3.11. I think the docs change would be helpful.

Cheers,
Harry


Harry Mallon
CODEX | Senior Software Engineer
60 Poland Street | London | England | W1F 7NT
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
--
Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https
Loading...