[CMake] How to find wxWidgets with cmake under Windows?

Miguel A. Figueroa-Villanueva miguelf at ieee.org
Sun Jul 6 03:40:15 EDT 2008

On Sat, Jul 5, 2008 at 9:17 PM, Bob Paddock wrote:
>> Ok, the problem is that you are finding wxWidgets "Unix Style"...
> I started with a CMakeLists.txt file from Linux, where it
> works fine.  Is that bad?  I'm trying to build with Mingw32-gcc.
> This part of what I have:
> # Find package for wxWidgets is required:
> IF( wxWidgets_FOUND )
>  # wxWidgets macros are required:
>  INCLUDE( ${wxWidgets_USE_FILE} )
> ...
> ELSE(wxWidgets_FOUND)
>  # wxWidgets was not found, cannot continue:
>  MESSAGE("wxWidgets not found! Internal variables are not pointing to the
> correct wxWidgets configuration.")
> ENDIF(wxWidgets_FOUND)
> Should I have something different?

No, this seems fine. For unix and windows the CMakeLists.txt file
should work transparently. It is just that it finds things
differently. With windows it searches for it according to the standard
places and finds each lib, etc. In unix (and in cygwin and msys also
for that matter) it uses wx-config.

>> this  was fixed about two weeks ago. You can either download the latest
>> binaries
> I did not see any newer than the 2.6 that I have, unless I build from CVS?

My bad, I meant this one or cvs:


>> or simply replace the FindwxWidgets file with this one:
>> http://www.cmake.org/cgi-bin/viewcvs.cgi/Modules/FindwxWidgets.cmake?revisi
> Did that.  It *still* tells me it can't wxWidgets. :-<
> I do have wxWidgets_ROOT_DIR now, and it is set to c:/wxwidgets-2.8.8 like
> I would expect it to be.

Ok, even if you didn't get the latest version of cmake if you are
getting wxWidgets_ROOT_DIR and it is being set to c:/wxwidgets-2.8.8,
then it is already better and it should be ok.

I'm unsure where MinGW will build the libs, since I don't use it... I
suppose it is not:


maybe something like:


If this is the case, then it won't find it automatically, but it will
allow you to set wxWidgets_LIB_DIR to the correct path. Remember to
empty the build directory and start over from scratch and please let
me know where are the libs being built with MinGW, so that I can add
automatic support for it.

>> I think, the slash shouldn't matter here... But it is safer to use the
>> forward slashes, since the backslash sometimes require escaping.
> Alright.  I switched WXWIN to C:/... , not that it helped. :-(
> I do want to thank you for your help.

Happy to help.


More information about the CMake mailing list