[cmake-developers] [CMake 0012258]: include_directories(SYSTEM ...) not functional with GNU Makefiles
Mantis Bug Tracker
mantis at public.kitware.com
Thu Jun 9 00:42:09 EDT 2011
The following issue has been SUBMITTED.
======================================================================
http://public.kitware.com/Bug/view.php?id=12258
======================================================================
Reported By: Campbell Barton
Assigned To:
======================================================================
Project: CMake
Issue ID: 12258
Category: CMake
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 2011-06-09 00:42 EDT
Last Modified: 2011-06-09 00:42 EDT
======================================================================
Summary: include_directories(SYSTEM ...) not functional with
GNU Makefiles
Description:
There were some system headers giving warnings compiling on linux,
since I like to have warnings as errors, and not edit system headers,
I used:
include_directories(SYSTEM dir1 dir2 ...)
... for system directories only.
However this does not result in -isystem being used in C because
GNU.cmake does not set:
set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
... as it does for C++.
I tried adding this directly after the project(), call (beforehand it
fails to have any effect):
if(CMAKE_COMPILER_IS_GNUCC)
if(NOT APPLE)
set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
endif()
endif()
So now it almost works, but I've noticed that If
"include_directories(SYSTEM" is called after a non system include, ALL
includes then use -isystem.
Putting "include_directories(SYSTEM" first mostly works out OK, but I
found a few cases where the order isn't so easy to set in our own
CMakeLists.txt and still incorrectly uses -isystem where it shouldn't.
Also found using the BEFORE / AFTER arguments to include_directories(
doesn't make any difference to the use of -isystem.
Is this a known problem or is there a way to get this working?
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2011-06-09 00:42 Campbell BartonNew Issue
======================================================================
More information about the cmake-developers
mailing list