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

Miguel A. Figueroa-Villanueva miguelf at ieee.org
Sat Jul 5 20:41:40 EDT 2008


On Sat, Jul 5, 2008 at 6:58 PM, Bob Paddock wrote:
>> The FindwxWidgets module just finds the already built wxWidgets libs
>> to use in your app.
>>
>> That said, I need to add the wxWidgets-2.8.8 prefix to the search
>> locations. I don't use the installer,
>
> Normally I don't either.  I only did it because it wasn't being found with
> the WXWIN environment variable.   I usually just unzip because I frequently
> build with different versions.
>
>> so I don't get the registry
>> setting. Could you let me know what registry key has the install
>> location (C:\wxWidgets-2.8.8) so I can add it to the search path?
>> Something like:
>
>
>> [HKEY_LOCAL_MACHINE\SOFTWARE\...]:InstallDir
>
> This is all I'm finding:
>
> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\wxWidgets_is1

ok, thanks.

>> In the mean time, you can either change the wxWidgets_ROOT_DIR
>> location using the GUI
>
> wxWidgets_CONFIG_EXECUTABLE-NOTFOUND
> wxWidgets_wxrc_EXECUTABLE-NOTFOUND
>
> are the only two wxWidgets I see in
> C:\program files\cmake 2.6\bin\cmake-gui.exe
> even with 'show advanced settings' set.
>
> Where should I be seeing wxWidgets_ROOT_DIR?

Ok, the problem is that you are finding wxWidgets "Unix Style"... this
was fixed about two weeks ago. You can either download the latest
binaries, or simply replace the FindwxWidgets file with this one:

http://www.cmake.org/cgi-bin/viewcvs.cgi/Modules/FindwxWidgets.cmake?revision=1.22&root=CMake&view=markup

Note that you should see the following, that will make MinGW use the
"Windows Style" search and then you'll see the wxWidgets_ROOT_DIR
variable:

IF(WIN32 AND NOT CYGWIN AND NOT MSYS)
  SET(wxWidgets_FIND_STYLE "win32")
ELSE(WIN32 AND NOT CYGWIN AND NOT MSYS)
  IF(UNIX OR MSYS)
    SET(wxWidgets_FIND_STYLE "unix")
  ENDIF(UNIX OR MSYS)
ENDIF(WIN32 AND NOT CYGWIN AND NOT MSYS)

Note however, that you probably won't need to set it manually since
you have WXWIN set...

>> to C:/wxWidgets-2.8.8 and it should detect
>> everything else or you can change the following piece of code in the
>> FindwxWidgets.cmake module:
>>
>>   FIND_PATH(wxWidgets_ROOT_DIR
>>     NAMES include/wx/wx.h
>>     PATHS
>>       $ENV{wxWidgets_ROOT_DIR}
>>       $ENV{WXWIN}
>
> Why did WXWIN not locate it?
>
>> "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninsta
>>ll\\wxWidgets_is1;Inno Setup: App Path]"  # WX 2.6.x
>>       C:/
>>       D:/
>>       $ENV{ProgramFiles}
>>     PATH_SUFFIXES
>>       wxWidgets-2.8.8                      # <--- add this location
>
> Did that. Still doesn't find it.  :-(
>
> I know it is at c:\wxWidgets-2.8.8 and works because I ran some of the sample
> programs after building it.
>
> You have C:/wxW... above where I have C:\wxW...  does the direction of the
> slash make a difference here?

I think, the slash shouldn't matter here... But it is safer to use the
forward slashes, since the backslash sometimes require escaping.

Well, please let me know if this works for you.

--Miguel


More information about the CMake mailing list