View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012258CMakeCMakepublic2011-06-09 00:422011-11-11 10:45
ReporterCampbell Barton 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
Platformx86-64OSlinuxOS Versionarch/latest
Product Version 
Target VersionCMake 2.8.5Fixed in VersionCMake 2.8.5 
Summary0012258: include_directories(SYSTEM ...) not functional with GNU Makefiles
DescriptionThere 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?
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0026829)
Campbell Barton (reporter)
2011-06-11 05:48

Update, ignore the order of calling include_directories(SYSTEM / include_directories(, this was an error on my part.

So the only problem is with CMAKE_INCLUDE_SYSTEM_FLAG_C not being set

According to Michael Hertling, GNU.cmake
 set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")

should be replaced with.
 set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
(0026851)
Brad King (manager)
2011-06-13 17:57

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=33f5a83a [^]
(0027773)
David Cole (manager)
2011-11-11 10:45

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2011-06-09 00:42 Campbell Barton New Issue
2011-06-11 05:48 Campbell Barton Note Added: 0026829
2011-06-13 17:52 Brad King Assigned To => Brad King
2011-06-13 17:52 Brad King Status new => assigned
2011-06-13 17:57 Brad King Note Added: 0026851
2011-06-13 17:57 Brad King Status assigned => resolved
2011-06-13 17:57 Brad King Resolution open => fixed
2011-06-18 07:46 David Cole Fixed in Version => CMake 2.8.5
2011-06-18 07:46 David Cole Target Version => CMake 2.8.5
2011-11-11 10:45 David Cole Note Added: 0027773
2011-11-11 10:45 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team