[cmake-developers] CMake API for warnings

Ruslan Baratov ruslan_baratov at yahoo.com
Tue Mar 29 11:42:50 EDT 2016


On 28-Mar-16 21:05, Brad King wrote:
> On 03/28/2016 01:49 AM, Geoffrey Viola wrote:
>> Thanks for the feedback. I’ll have to look more in-depth at Xcode specific issues.
>>> Take a look at this approach:
>>> * https://github.com/ruslo/sugar/wiki/Cross-platform-warning-suppression
>> I took a look at your repository. It’s very sophisticated.
> I'd prefer to see an approach that abstracts the warning levels
> in a similar way to COMPILE_FEATURES, COMPILE_DEFINITIONS,
> INCLUDE_DIRECTORIES, etc.  Project code would set directory or
> target properties to specify warning levels and the generators
> would map them to the proper flags or project file settings
> automatically.
>
> Something like this has long been missing for compiler warnings
> and optimization levels.
>
> -Brad
>
One more note. Properties is a good abstraction and works great for the 
native CMake project. But there is a tricky scenario about them - when 
we need to create ExternalProject_Add for the non-CMake project.
E.g. when I have CMAKE_POSITION_INDEPENDENT_CODE variable set to `YES` I 
need to add `-fPIC` to the flags manually, or check `CXX_STANDARD 11` 
and add `-std=c++11`. I guess I can handle such simple cases but I can 
predict that for warnings it will be a huge pain.
How CMake can help me avoid violating DRY?

Ruslo


More information about the cmake-developers mailing list