[CMake] cmake 2.6-RC-8: Problem with WxWidgets 2.8 on OSX 10.3

Honest Guvnor honestguvnor at googlemail.com
Tue Apr 15 17:10:24 EDT 2008


On Tue, Apr 15, 2008 at 6:47 PM, David Cole <david.cole at kitware.com> wrote:
> Is there a sample CMake project that I could try to reproduce this with? Or
> could you send me access to your source tree? Is it an open source project?

Copy minimal.cpp (and sample.xpm) from wxWidgets samples directory with:

CMakeLists.txt ------------------------------------------------------

cmake_minimum_required(VERSION 2.6)

project(FRED C CXX Fortran)

set(CMAKE_VERBOSE_MAKEFILE TRUE)

FIND_PACKAGE(wxWidgets COMPONENTS base core gl)
if(wxWidgets_FOUND)
    include(${wxWidgets_USE_FILE})
else(wxWidgets_FOUND)
    message("ERROR: wxWidgets not found!")
endif(wxWidgets_FOUND)

include_directories(${wxWidgets_INCLUDE_DIRS} )

add_executable(fred minimal.cpp)

SET_TARGET_PROPERTIES(fred
        PROPERTIES
        LINKER_LANGUAGE CXX)

target_link_libraries(fred ${wxWidgets_LIBRARIES})

=================================================================================================
bolt:~/cmaketest andy$ cmake .; make
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- The Fortran compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler info
-- Detecting C compiler info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler info
-- Detecting CXX compiler info - done
-- Check for working Fortran compiler: /usr/local/bin/gfortran
-- Check for working Fortran compiler: /usr/local/bin/gfortran -- works
-- Checking whether /usr/local/bin/gfortran supports Fortran 90
-- Checking whether /usr/local/bin/gfortran supports Fortran 90 -- yes
-- Found wxWidgets: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/andy/cmaketest
/usr/local/bin/cmake -H/Users/andy/cmaketest -B/Users/andy/cmaketest
--check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/bin/cmake -E cmake_progress_start
/Users/andy/cmaketest/CMakeFiles
/Users/andy/cmaketest/CMakeFiles/progress.make
make -f CMakeFiles/Makefile2 all
make -f CMakeFiles/fred.dir/build.make CMakeFiles/fred.dir/depend
cd /Users/andy/cmaketest && /usr/local/bin/cmake -E cmake_depends
"Unix Makefiles" /Users/andy/cmaketest /Users/andy/cmaketest
/Users/andy/cmaketest /Users
/andy/cmaketest
/Users/andy/cmaketest/CMakeFiles/fred.dir/DependInfo.cmake --color=
make -f CMakeFiles/fred.dir/build.make CMakeFiles/fred.dir/build
/usr/local/bin/cmake -E cmake_progress_report /Users/andy/cmaketest/CMakeFiles 1
[100%] Building CXX object CMakeFiles/fred.dir/minimal.cpp.o
/usr/bin/c++   -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXMAC__
-D__WXMAC__ -isystem
/usr/local/lib/wx/include/mac-ansi-release-static-2.8 -isystem /usr/l
ocal/include/wx-2.8   -o CMakeFiles/fred.dir/minimal.cpp.o -c
/Users/andy/cmaketest/minimal.cpp
In file included from /usr/local/include/wx-2.8/wx/wxprec.h:13,
                 from /Users/andy/cmaketest/minimal.cpp:21:
/usr/local/include/wx-2.8/wx/defs.h:609: error: template with C linkage
In file included from /usr/local/include/wx-2.8/wx/memory.h:16,
                 from /usr/local/include/wx-2.8/wx/object.h:20,
                 from /usr/local/include/wx-2.8/wx/wx.h:16,
                 from /Users/andy/cmaketest/minimal.cpp:30:
/usr/local/include/wx-2.8/wx/string.h:994: error: declaration of C function `
   wxString operator+(const wxString&, char)' conflicts with
/usr/local/include/wx-2.8/wx/string.h:992: error: previous declaration `
   wxString operator+(const wxString&, const wxString&)' here
/usr/local/include/wx-2.8/wx/string.h:996: error: declaration of C function `
   wxString operator+(char, const wxString&)' conflicts with
...

=================================================================================================
In Darwin.cmake change this:

# Xcode does not support -isystem yet.
IF(XCODE)
  SET(CMAKE_INCLUDE_SYSTEM_FLAG_C)
  SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
ENDIF(XCODE)

to this:

# Xcode does not support -isystem yet.
###IF(XCODE)
  SET(CMAKE_INCLUDE_SYSTEM_FLAG_C)
  SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
###ENDIF(XCODE)

To give:

=================================================================================================
bolt:~/cmaketest andy$ make clean; rm CMakeCache.txt; cmake .; make
make -f CMakeFiles/Makefile2 clean
make -f CMakeFiles/fred.dir/build.make CMakeFiles/fred.dir/clean
/usr/local/bin/cmake -P CMakeFiles/fred.dir/cmake_clean.cmake
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- The Fortran compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler info
-- Detecting C compiler info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler info
-- Detecting CXX compiler info - done
-- Check for working Fortran compiler: /usr/local/bin/gfortran
-- Check for working Fortran compiler: /usr/local/bin/gfortran -- works
-- Checking whether /usr/local/bin/gfortran supports Fortran 90
-- Checking whether /usr/local/bin/gfortran supports Fortran 90 -- yes
-- Found wxWidgets: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/andy/cmaketest
/usr/local/bin/cmake -H/Users/andy/cmaketest -B/Users/andy/cmaketest
--check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/bin/cmake -E cmake_progress_start
/Users/andy/cmaketest/CMakeFiles
/Users/andy/cmaketest/CMakeFiles/progress.make
make -f CMakeFiles/Makefile2 all
make -f CMakeFiles/fred.dir/build.make CMakeFiles/fred.dir/depend
cd /Users/andy/cmaketest && /usr/local/bin/cmake -E cmake_depends
"Unix Makefiles" /Users/andy/cmaketest /Users/andy/cmaketest
/Users/andy/cmaketest
 /Users/andy/cmaketest
/Users/andy/cmaketest/CMakeFiles/fred.dir/DependInfo.cmake --color=
make -f CMakeFiles/fred.dir/build.make CMakeFiles/fred.dir/build
/usr/local/bin/cmake -E cmake_progress_report /Users/andy/cmaketest/CMakeFiles 1
[100%] Building CXX object CMakeFiles/fred.dir/minimal.cpp.o
/usr/bin/c++   -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXMAC__
-D__WXMAC__ -I/usr/local/lib/wx/include/mac-ansi-release-static-2.8
-I/usr/local/in
clude/wx-2.8   -o CMakeFiles/fred.dir/minimal.cpp.o -c
/Users/andy/cmaketest/minimal.cpp
Linking CXX executable fred
/usr/local/bin/cmake -E cmake_link_script CMakeFiles/fred.dir/link.txt
--verbose=1
/usr/bin/c++   -D__WXMAC__ -Wl,-search_paths_first
-headerpad_max_install_names -fPIC CMakeFiles/fred.dir/minimal.cpp.o
-o fred  -L/usr/local/lib -
L/usr/local/lib -framework QuickTime -framework IOKit -framework
Carbon -framework Cocoa -framework System
/usr/local/lib/libwx_base_carbon-2.8.a /u
sr/local/lib/libwx_mac_core-2.8.a /usr/local/lib/libwx_mac_gl-2.8.a
-lwxexpat-2.8 -lwxtiff-2.8 -lwxjpeg-2.8 -lwxpng-2.8 -lz -lpthread
-liconv -frame
work WebKit -framework OpenGL -framework AGL
/usr/local/bin/cmake -E cmake_progress_report
/Users/andy/cmaketest/CMakeFiles  1
[100%] Built target fred
/usr/local/bin/cmake -E cmake_progress_start /Users/andy/cmaketest/CMakeFiles 0
bolt:~/cmaketest andy$

The isystem flag is recognised by gcc but whatever it is supposed to
do does not seem to work. Someone has disabled it for xcode but left
it in for those outside xcode. Perhaps it works in versions after OSX
10.3. Perhaps the environment is nonstandard and broken on this
computer but I do not have easy access to another Mac at the moment.


More information about the CMake mailing list