[CMake] FindxxWidgets.cmake: wrong wxWidgets_INCLUDE_DIRS on UNIX

Marcel Loose loose at astron.nl
Thu Jul 2 04:20:01 EDT 2009


On Thursday 02 July 2009 09:15:33 Florent Teichteil wrote:
> Miguel A. Figueroa-Villanueva a écrit :
> > On Wed, Jul 1, 2009 at 2:02 PM, Tyler Roscoe wrote:
> >> On Wed, Jul 01, 2009 at 07:23:27PM +0200, Florent Teichteil wrote:
> >>> // BEGINNING OF CMakeLists.txt
> >>>
> >>> set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
> >>> find_package(wxWidgets COMPONENTS base core REQUIRED)
> >>> include_directories(${wxWidgets_INCLUDE_DIRS})
> >>> add_definitions(${wxWidgets_DEFINITIONS})
> >>> message(STATUS ${wxWidgets_INCLUDE_DIRS})
> >>>
> >>> // END OF CMakeLists.txt
> >>>
> >>> When I run "cmake ." in a terminal window, I get the following output:
> >>
> >> Don't do in-source builds, for they lead to suffering. Check the FAQ for
> >> details.
> >
> > This is very good advice, of course...
> >
> >>> -- /usr/lib/wx/include/gtk2-unicode-release-2.8/usr/include/wx-2.8
> >>> -- Configuring done
> >>> -- Generating done
> >>>
> >>> The first line gives the value of "wxWidgets_INCLUDE_DIRS" which is
> >>> obviously wrong. It seems 2 paths have been concatenated without white
> >>> space. I think it should be something like
> >>> "/usr/lib/wx/include/gtk2-unicode-release-2.8 /usr/include/wx-2.8".
> >>
> >> Try message(STATUS "${wxWidgets_INCLUDE_DIRS}"). My guess is that
> >> variable is a list and the way you are using it in message() is
> >> flattening that list.
> >
> > This is most likely the case. Thanks Tyler.
> >
> > Also, Florent, do you actually have a problem? I mean besides the
> > output line not matching what you expect; can you build a simple app?
>
> Thank you for advices!
> I tried message(STATUS "${wxWidgets_INCLUDE_DIRS}") that adds a
> semicolon between the paths. I'm not sure that gcc is able to parse
> include paths separated by semicolons.
> Anyway, when I try to make the project, gcc complains it can't find
> wxwidgets headers. For instance, the compilation of a source file
> containing the line "#include <wx/wx.h>" gives the following error
> message (in French): "erreur: wx/wx.h : Aucun fichier ou dossier de ce
> type". It means that gcc can't find the <wx/wx.h> include file.
>
> Thanks again, guys!
> Florent
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
Hi Florent,

Most shells will treat a semicolon as a statement separator. So, my guess is 
that gcc is invoked on wx/wx.h This is not a gcc issue. The correct way to do 
this is to use

  include_directories(${wxWidgets_INCLUDE_DIRS)

in your CMakeLists.txt fie. CMake will translate this into the correct include 
paths (-I<path>) strings that can be parsed by gcc.

Best regards,
Marcel Loose.



More information about the CMake mailing list