I have committed a fix to CVS CMake that should avoid this problem in the future. It should be included in the next CMake 2.6 RC.<br><br><div><div>$ cvs commit -m "BUG: There are compiler problems with wxWidgets and INCLUDE_DIRECTORIES(SYSTEM ...) use on the Mac. Set variable wxWidgets_INCLUDE_DIRS_NO_SYSTEM on the Mac in FindwxWidgets.cmake to avoid these problems." FindwxWidgets.cmake<br>
</div><div>/cvsroot/CMake/CMake/Modules/FindwxWidgets.cmake,v <-- FindwxWidgets.cmake</div><div>new revision: 1.19; previous revision: 1.18</div><div><br></div><div>As a workaround (for now, until the next CMake 2.6 RC, or possibly to get past this problem with CMake 2.4.8, although I have not verified with 2.4.8) you can do the following in your CMakeLists.txt file *before* including UsewxWidgets.cmake:</div>
<div><br></div><div>SET(wxWidgets_INCLUDE_DIRS_NO_SYSTEM 1)</div><div><br></div><div><br></div><div>By the way, "-isystem" seems to work fine on the Mac for other directories (besides the wxWidgets include directory). There is a CMake test named "complex" that exercises the INCLUDE_DIRECTORIES(SYSTEM ...) functionality and it passes on all our Mac dashboards.</div>
<div><br></div><div><br></div><div>HTH,</div><div>David</div><div><br></div><div><br></div><div class="gmail_quote">On Tue, Apr 15, 2008 at 5:10 PM, Honest Guvnor <<a href="mailto:honestguvnor@googlemail.com">honestguvnor@googlemail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="Ih2E3d">On Tue, Apr 15, 2008 at 6:47 PM, David Cole <<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>> wrote:<br>
> Is there a sample CMake project that I could try to reproduce this with? Or<br>
> could you send me access to your source tree? Is it an open source project?<br>
<br>
</div>Copy minimal.cpp (and sample.xpm) from wxWidgets samples directory with:<br>
<br>
CMakeLists.txt ------------------------------------------------------<br>
<br>
cmake_minimum_required(VERSION 2.6)<br>
<br>
project(FRED C CXX Fortran)<br>
<br>
set(CMAKE_VERBOSE_MAKEFILE TRUE)<br>
<br>
FIND_PACKAGE(wxWidgets COMPONENTS base core gl)<br>
if(wxWidgets_FOUND)<br>
include(${wxWidgets_USE_FILE})<br>
else(wxWidgets_FOUND)<br>
message("ERROR: wxWidgets not found!")<br>
endif(wxWidgets_FOUND)<br>
<br>
include_directories(${wxWidgets_INCLUDE_DIRS} )<br>
<br>
add_executable(fred minimal.cpp)<br>
<br>
SET_TARGET_PROPERTIES(fred<br>
PROPERTIES<br>
LINKER_LANGUAGE CXX)<br>
<br>
target_link_libraries(fred ${wxWidgets_LIBRARIES})<br>
<br>
=================================================================================================<br>
bolt:~/cmaketest andy$ cmake .; make<br>
-- The C compiler identification is GNU<br>
-- The CXX compiler identification is GNU<br>
-- The Fortran compiler identification is GNU<br>
-- Check for working C compiler: /usr/bin/gcc<br>
-- Check for working C compiler: /usr/bin/gcc -- works<br>
-- Detecting C compiler info<br>
-- Detecting C compiler info - done<br>
-- Check for working CXX compiler: /usr/bin/c++<br>
-- Check for working CXX compiler: /usr/bin/c++ -- works<br>
-- Detecting CXX compiler info<br>
-- Detecting CXX compiler info - done<br>
-- Check for working Fortran compiler: /usr/local/bin/gfortran<br>
-- Check for working Fortran compiler: /usr/local/bin/gfortran -- works<br>
-- Checking whether /usr/local/bin/gfortran supports Fortran 90<br>
-- Checking whether /usr/local/bin/gfortran supports Fortran 90 -- yes<br>
-- Found wxWidgets: TRUE<br>
-- Configuring done<br>
-- Generating done<br>
-- Build files have been written to: /Users/andy/cmaketest<br>
/usr/local/bin/cmake -H/Users/andy/cmaketest -B/Users/andy/cmaketest<br>
--check-build-system CMakeFiles/Makefile.cmake 0<br>
/usr/local/bin/cmake -E cmake_progress_start<br>
/Users/andy/cmaketest/CMakeFiles<br>
/Users/andy/cmaketest/CMakeFiles/progress.make<br>
make -f CMakeFiles/Makefile2 all<br>
make -f CMakeFiles/fred.dir/build.make CMakeFiles/fred.dir/depend<br>
cd /Users/andy/cmaketest && /usr/local/bin/cmake -E cmake_depends<br>
"Unix Makefiles" /Users/andy/cmaketest /Users/andy/cmaketest<br>
/Users/andy/cmaketest /Users<br>
/andy/cmaketest<br>
/Users/andy/cmaketest/CMakeFiles/fred.dir/DependInfo.cmake --color=<br>
make -f CMakeFiles/fred.dir/build.make CMakeFiles/fred.dir/build<br>
/usr/local/bin/cmake -E cmake_progress_report /Users/andy/cmaketest/CMakeFiles 1<br>
[100%] Building CXX object CMakeFiles/fred.dir/minimal.cpp.o<br>
<div class="Ih2E3d">/usr/bin/c++ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXMAC__<br>
</div>-D__WXMAC__ -isystem<br>
<div class="Ih2E3d">/usr/local/lib/wx/include/mac-ansi-release-static-2.8 -isystem /usr/l<br>
</div>ocal/include/wx-2.8 -o CMakeFiles/fred.dir/minimal.cpp.o -c<br>
/Users/andy/cmaketest/minimal.cpp<br>
In file included from /usr/local/include/wx-2.8/wx/wxprec.h:13,<br>
from /Users/andy/cmaketest/minimal.cpp:21:<br>
<div class="Ih2E3d">/usr/local/include/wx-2.8/wx/defs.h:609: error: template with C linkage<br>
In file included from /usr/local/include/wx-2.8/wx/memory.h:16,<br>
from /usr/local/include/wx-2.8/wx/object.h:20,<br>
from /usr/local/include/wx-2.8/wx/wx.h:16,<br>
</div> from /Users/andy/cmaketest/minimal.cpp:30:<br>
<div class="Ih2E3d">/usr/local/include/wx-2.8/wx/string.h:994: error: declaration of C function `<br>
wxString operator+(const wxString&, char)' conflicts with<br>
/usr/local/include/wx-2.8/wx/string.h:992: error: previous declaration `<br>
wxString operator+(const wxString&, const wxString&)' here<br>
/usr/local/include/wx-2.8/wx/string.h:996: error: declaration of C function `<br>
wxString operator+(char, const wxString&)' conflicts with<br>
</div>...<br>
<br>
=================================================================================================<br>
In Darwin.cmake change this:<br>
<br>
# Xcode does not support -isystem yet.<br>
IF(XCODE)<br>
SET(CMAKE_INCLUDE_SYSTEM_FLAG_C)<br>
SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX)<br>
ENDIF(XCODE)<br>
<br>
to this:<br>
<br>
# Xcode does not support -isystem yet.<br>
###IF(XCODE)<br>
SET(CMAKE_INCLUDE_SYSTEM_FLAG_C)<br>
SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX)<br>
###ENDIF(XCODE)<br>
<br>
To give:<br>
<br>
=================================================================================================<br>
bolt:~/cmaketest andy$ make clean; rm CMakeCache.txt; cmake .; make<br>
make -f CMakeFiles/Makefile2 clean<br>
make -f CMakeFiles/fred.dir/build.make CMakeFiles/fred.dir/clean<br>
/usr/local/bin/cmake -P CMakeFiles/fred.dir/cmake_clean.cmake<br>
-- The C compiler identification is GNU<br>
-- The CXX compiler identification is GNU<br>
-- The Fortran compiler identification is GNU<br>
-- Check for working C compiler: /usr/bin/gcc<br>
-- Check for working C compiler: /usr/bin/gcc -- works<br>
-- Detecting C compiler info<br>
-- Detecting C compiler info - done<br>
-- Check for working CXX compiler: /usr/bin/c++<br>
-- Check for working CXX compiler: /usr/bin/c++ -- works<br>
-- Detecting CXX compiler info<br>
-- Detecting CXX compiler info - done<br>
-- Check for working Fortran compiler: /usr/local/bin/gfortran<br>
-- Check for working Fortran compiler: /usr/local/bin/gfortran -- works<br>
-- Checking whether /usr/local/bin/gfortran supports Fortran 90<br>
-- Checking whether /usr/local/bin/gfortran supports Fortran 90 -- yes<br>
-- Found wxWidgets: TRUE<br>
-- Configuring done<br>
-- Generating done<br>
-- Build files have been written to: /Users/andy/cmaketest<br>
/usr/local/bin/cmake -H/Users/andy/cmaketest -B/Users/andy/cmaketest<br>
--check-build-system CMakeFiles/Makefile.cmake 0<br>
/usr/local/bin/cmake -E cmake_progress_start<br>
/Users/andy/cmaketest/CMakeFiles<br>
/Users/andy/cmaketest/CMakeFiles/progress.make<br>
make -f CMakeFiles/Makefile2 all<br>
make -f CMakeFiles/fred.dir/build.make CMakeFiles/fred.dir/depend<br>
cd /Users/andy/cmaketest && /usr/local/bin/cmake -E cmake_depends<br>
"Unix Makefiles" /Users/andy/cmaketest /Users/andy/cmaketest<br>
/Users/andy/cmaketest<br>
/Users/andy/cmaketest<br>
/Users/andy/cmaketest/CMakeFiles/fred.dir/DependInfo.cmake --color=<br>
make -f CMakeFiles/fred.dir/build.make CMakeFiles/fred.dir/build<br>
/usr/local/bin/cmake -E cmake_progress_report /Users/andy/cmaketest/CMakeFiles 1<br>
[100%] Building CXX object CMakeFiles/fred.dir/minimal.cpp.o<br>
<div class="Ih2E3d">/usr/bin/c++ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXMAC__<br>
</div>-D__WXMAC__ -I/usr/local/lib/wx/include/mac-ansi-release-static-2.8<br>
-I/usr/local/in<br>
clude/wx-2.8 -o CMakeFiles/fred.dir/minimal.cpp.o -c<br>
/Users/andy/cmaketest/minimal.cpp<br>
Linking CXX executable fred<br>
/usr/local/bin/cmake -E cmake_link_script CMakeFiles/fred.dir/link.txt<br>
--verbose=1<br>
/usr/bin/c++ -D__WXMAC__ -Wl,-search_paths_first<br>
-headerpad_max_install_names -fPIC CMakeFiles/fred.dir/minimal.cpp.o<br>
-o fred -L/usr/local/lib -<br>
L/usr/local/lib -framework QuickTime -framework IOKit -framework<br>
Carbon -framework Cocoa -framework System<br>
/usr/local/lib/libwx_base_carbon-2.8.a /u<br>
sr/local/lib/libwx_mac_core-2.8.a /usr/local/lib/libwx_mac_gl-2.8.a<br>
-lwxexpat-2.8 -lwxtiff-2.8 -lwxjpeg-2.8 -lwxpng-2.8 -lz -lpthread<br>
-liconv -frame<br>
work WebKit -framework OpenGL -framework AGL<br>
/usr/local/bin/cmake -E cmake_progress_report<br>
/Users/andy/cmaketest/CMakeFiles 1<br>
[100%] Built target fred<br>
/usr/local/bin/cmake -E cmake_progress_start /Users/andy/cmaketest/CMakeFiles 0<br>
bolt:~/cmaketest andy$<br>
<br>
The isystem flag is recognised by gcc but whatever it is supposed to<br>
do does not seem to work. Someone has disabled it for xcode but left<br>
it in for those outside xcode. Perhaps it works in versions after OSX<br>
10.3. Perhaps the environment is nonstandard and broken on this<br>
computer but I do not have easy access to another Mac at the moment.<br>
</blockquote></div><br></div>