[cmake-developers] compile_options command

Stephen Kelly steveire at gmail.com
Mon Jun 3 12:38:24 EDT 2013


Hi there,

While most of the new features I've been writing have been about moving away 
from directory-scoped commands towards target scoped commands, one command 
which I think still makes sense as a directory scoped command would be a 
command for setting compile options. Currently warnings etc, which are 
mostly globally enabled for a project, are set with code like:

 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wundef")

To move away from a whitespace-separated-string API to a list API, we could 
instead have something like

 compile_options(-Wundef)

or 

 add_compile_options(-Wundef)

behave similarly to how include_directories() behaves - ie, populate a 
directory property and use that to initialize the content of the target 
COMPILE_OPTIONS property.

Comments?

Thanks,

Steve.





More information about the cmake-developers mailing list