[CMake] Appending to CMAKE_CXX_FLAGS

Richard A. Smith smith at whoop.com
Tue Sep 11 14:40:57 EDT 2018


On 09/11/2018 01:03 PM, Marc CHEVRIER wrote:

> The best approach is to use properties (see 
> https://cmake.org/cmake/help/git-master/manual/cmake-properties.7.html).
> 
> At directory level and target level you can use property 
> 'COMPILE_OPTIONS'.  These properties can be updated using, respectively 
> 'add_compile_options' and 'target_compile_options'.

If you have assembly files you may run into trouble.

See my question:  https://www.mail-archive.com/cmake@cmake.org/msg59526.html

I don't have a solution yet.

> 
> Le mar. 11 sept. 2018 à 17:58, Michael Jackson 
> <mike.jackson at bluequartz.net <mailto:mike.jackson at bluequartz.net>> a écrit :
> 
>     What is the “modern” way to append to CMAKE_CXX_FLAGS? This is the
>     logic that I would like:____
> 
>     __ __
> 
>     If (MSVC)____
> 
>                      Set(CMAKE_CXX_FLAGS ${ CMAKE_CXX_FLAGS} “/MP”)____
> 
>     Endif()____
> 
>     __ __
> 
>     I have always heard that appending to the compile flags in this way
>     is “bad”. What is the best practice for doing this?____
> 
>     __ __
> 
>     Thanks____
> 
>     --____
> 
>     Michael Jackson | Owner, President____
> 
>            BlueQuartz Software____
> 
>     [e] mike.jackson at bluequartz.net <mailto:mike.jackson at bluequartz.net>____
> 
>     [w] www.bluequartz.net <http://www.bluequartz.net>____
-- 
Richard A. Smith
smith at whoop.com


More information about the CMake mailing list