MantisBT - CMake
View Issue Details
0004462CMakeCMakepublic2007-02-14 09:292016-02-07 07:18
Ludovic Rousseau 
Brad King 
urgentmajoralways
closedfixed 
 
 
0004462: Do not use -isystem on Mac OS X
Mac OS X does not support -isystem instead of -I

The compilation fails with errors like:
/usr/include/wx-2.5/wx/defs.h:528: error: template with C linkage
/usr/include/wx-2.5/wx/string.h:940: error: declaration of C function 'wxString operator+(const wxString&, wxChar)' conflicts with
/usr/include/wx-2.5/wx/string.h:938: error: previous declaration 'wxString operator+(const wxString&, const wxString&)' here
/usr/include/wx-2.5/wx/string.h:942: error: declaration of C function 'wxString operator+(wxChar, const wxString&)' conflicts with
/usr/include/wx-2.5/wx/string.h:940: error: previous declaration 'wxString operator+(const wxString&, wxChar)' here
/usr/include/wx-2.5/wx/string.h:944: error: declaration of C function 'wxString operator+(const wxString&, const wxChar*)' conflicts with
/usr/include/wx-2.5/wx/string.h:942: error: previous declaration 'wxString operator+(wxChar, const wxString&)' here

I already reported a similar bug (Bug 0003453 - FindwxWindows.cmake: do not modify the output of wx-config --cxxflags) so that -isystem is not used on Mac OS X for wx-widgets.

It now looks like cmake 2.4.6 uses -isystem at a higher level and not just if wx-widgets is used.

Proposed patch:
--- ./Modules/Platform/gcc.cmake.orig 2007-02-14 15:03:12.000000000 +0100
+++ ./Modules/Platform/gcc.cmake 2007-02-14 15:26:44.000000000 +0100
@@ -17,6 +17,8 @@
   SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
   SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
   SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
- SET (CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")
+ IF(NOT APPLE)
+ SET (CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")
+ ENDIF(NOT APPLE)
 ENDIF(CMAKE_COMPILER_IS_GNUCXX)

I don't know if CMAKE_INCLUDE_SYSTEM_FLAG_C must be changed the same way CMAKE_INCLUDE_SYSTEM_FLAG_CXX is. Maybe yes.

Bye
No tags attached.
related to 0010837closed Gregor Jasny GCC flag -isystem not applied on OS X 
related to 0015953closed Gregor Jasny CMake Does Not Use -isystem with GCC on OS X 
Issue History
2011-01-07 16:49Brad KingRelationship addedrelated to 0010837
2016-02-07 07:18Gregor JasnyRelationship addedrelated to 0015953

Notes
(0006461)
Brad King   
2007-02-19 13:53   
/cvsroot/CMake/CMake/Modules/Platform/gcc.cmake,v <-- gcc.cmake
new revision: 1.14; previous revision: 1.13