[CMake] CMake 2.4 (8) & WxWidgets + RichText Pt 2

Miguel A. Figueroa-Villanueva miguelf at ieee.org
Mon Apr 21 15:17:55 EDT 2008


On Mon, Apr 21, 2008 at 1:36 PM, Eric Torstenson wrote:
> On Mon, Apr 21, 2008 at 12:27 PM, Miguel A. Figueroa-Villanueva wrote:
> > Hello Eric,
> >
> > I'm glad to here this worked. Now, I would like to understand the
> > problem, so that I can fix the FindwxWidgets module. Can you post
> > exactly what chages did you make to the FindwxWidgets (a diff patch
> > would be fine)?
> >
> > 1. In windows, it makes sense to add the richtext lib, because it
> > relies on it to find all possible libraries. I suppose that you added
> > it to the following line:
> >
> >    FOREACH(LIB core adv aui html media xrc dbgrid gl qa)
> >
> > 2. In linux/unix, I am returning what the `wx-config --libs <libs>`
> > returns. I believe that the problem you were having was due to a
> > parsing bug, which should be fixed in the latest version. However, the
> > above list wouldn't have helped. If the latest version still has the
> > bug, then let me know so that I can explore the issue further.
> >
> > You can always find a latest version of the module for comparison at:
> >
> >
> http://www.cmake.org/cgi-bin/viewcvs.cgi/Modules/FindwxWidgets.cmake?root=CMake&view=markup
> >
> > Thanks in advance for the report,
> > --Miguel

> Hi Miguel,
>
>  Well, with this in mind, I did a bit of playing, and decided that the
> problem wasn't so much that FindwxWidgets.cmake needed to be changed, but
> instead, I was calling it incorrectly.
>
>  What I had to do was as follows:
>
>  SET (wxWidgets_USE_LIBS aui richtext adv html core xml base xrc qa net)
>  SET (wxWidgets_FIND_COMPONENTS true)
>
>  FIND_PACKAGE(wxWidgets)
>  IF (wxWidgets_FOUND)
>    INCLUDE (${wxWidgets_USE_FILE})
>    #Project name is just the project being built
>    TARGET_LINK_LIBRARIES(${ProjectName} ${wxWidgets_LIBRARIES})
>  ENDIF (wxWidgets_FOUND)

wxWidgets_USE_LIBS is deprecated. Of course, I don't know what version
you have, but the correct way should be as:

FIND_PACKAGE(wxWidgets COMPONENTS aui richtext adv html core xml base
xrc qa net)
IF (wxWidgets_FOUND)
  INCLUDE (${wxWidgets_USE_FILE})
  #Project name is just the project being built
  TARGET_LINK_LIBRARIES(${ProjectName} ${wxWidgets_LIBRARIES})
ENDIF (wxWidgets_FOUND)


>  Since, by default, FIND_COMPONENTS is false, it was using what you
> described as the windows mechanism. Which did work after I added those two
> components to the underlying cmakefiles, but what I really needed to do was
> set it up so your module would find them using the other logic.
>
>  So, I think I finally got it straightened out.

You should not set wxWidgets_FIND_COMPONENTS since this is handled by
CMake itself depending on whether you passed any components or not. It
is set to false since you are not passing any components, but rather
using the USE_Libs variable.

The use of the windows or unix way is based solely on the following:

IF(WIN32)
  SET(WIN32_STYLE_FIND 1)
ENDIF(WIN32)
IF(MINGW)
  SET(WIN32_STYLE_FIND 0)
  SET(UNIX_STYLE_FIND 1)
ENDIF(MINGW)
IF(UNIX)
  SET(UNIX_STYLE_FIND 1)
ENDIF(UNIX)

If it is giving you problems, then we need to add code for your
platform. Which is? Can you verify the value of these variables (i.e.,
WIN32_STYLE_FIND and UNIX_STYLE_FIND).

--Miguel


More information about the CMake mailing list