[CMake] Can't get cmake to do debug build with wxwidgets

Miguel A. Figueroa-Villanueva miguelf at ieee.org
Sun Dec 2 08:47:45 EST 2007


On Dec 2, 2007 9:18 AM, Joseph Garvin wrote:
> On Dec 1, 2007 11:38 AM, Miguel A. Figueroa-Villanueva < miguelf at ieee.org>
> wrote:
> > On Nov 30, 2007 1:43 PM, Joseph Garvin wrote:
> > > Under windows, everything works fine. However, trying to build my
> project on
> > > Linux, I think that cmake isn't properly setting up linking against the
> > > debug versions of the wxwidgets libraries. wxWidgets has a function,
> > > wxLogDebug, that prints text in debug mode but does nothing in release
> mode.
> > > Even if I run cmake in wizard mode and tell it to only build Debug mode,
> > > wxLogDebug does not print anything in my app. I've double checked that I
> > > have the debug libraries installed, and I don't get any error messages.
> I'm
> > > using FIND_PACKAGE(wxWidgets), and TARGET_LINK_LIBRARIES(myapp
> > > ${wxWidgets_LIBRARIES}). Any ideas? Using Cmake v2.4 - patch7 running on
> > > Ubuntu against wxWidgets 2.8.4.
> >
> > Can you provide the CMakeLists.txt and CMakeCache.txt files?
> >
> > You must be doing something else because just:
> >
> >  FIND_PACKAGE(wxWidgets) should not
> >
> >  TARGET_LINK_LIBRARIES(myapp ${wxWidgets_LIBRARIES})
> >
> > won't work. You need to specify the modules you want to link with and
> > posibly make use of the UsewxWidgets.cmake file, although I don't use
> > it.

> Sorry, I didn't mention that I have this above FIND_PACKAGE:
>
> SET(wxWidgets_USE_LIBS base core gl adv)

This is deprecated... you should use:

FIND_PACKAGE(wxWidgets COMPONENTS base core gl adv)

or

FIND_PACKAGE(wxWidgets REQUIRED base core gl adv)

> SET(WXWINDOWS_USE_GL 1)

This is related to an old wxWindows module, won't change anything in
the new module... note the WXWINDOWS part rather than WXWIDGETS or
wxWidgets.

You still need the INCLUDE(${wxWidgets_USE_FILE})...

All that is just to use the module properly... From "cmake
--help-module FindwxWidgets":

       Sample usage:

          FIND_PACKAGE(wxWidgets COMPONENTS base core gl net)
          IF(wxWidgets_FOUND)
            INCLUDE(${wxWidgets_USE_FILE})
            # and for each of your dependant executable/library targets:
            TARGET_LINK_LIBRARIES(<YourTarget> ${wxWidgets_LIBRARIES})
          ENDIF(wxWidgets_FOUND)

It is possible that the __WXDEBUG__ is still needed for windows (i
would need to go in and check), but for linux wx-config determines
what compile flags it needs...

--Miguel


More information about the CMake mailing list