[CMake] cmake and wxwidgets on windows

Miguel A. Figueroa-Villanueva miguelf at ieee.org
Thu Oct 30 06:58:23 EDT 2008


On Wed, Oct 29, 2008 at 1:08 PM, John <dbgtjp at hotmail.com> wrote:
> hi,
>
> I'm trying to compile my code on windows with cmake. I use wxwidgets 2.8.9.
> which works on linux without any problem.
> However on windows cmake does not find the wxwidgets packages.
> What can be wrong? I set the environment variable to the wxwidgets directory.
> wxWidgets_ROOT_DIR is found, but not LIB_DIR and wxrc_EXECUTABLE.

Try the latest FindwxWidgets.cmake. You can just replace this file in
your installation (make a backup of the current one, of course) or put
it in a local modules dir. It can be found at:

http://public.kitware.com/cgi-bin/viewcvs.cgi/Modules/FindwxWidgets.cmake?root=CMake&view=markup

Also, if wxWidgets_LIB_DIR is not found, you can set it manually or in
the CMakeLists.txt. Although, I recognize it would be better for the
module to find it, which it should do.

> below see my CMakeLists.txt.
>
> #CMake project file for acrls
>
> PROJECT(acrls)
>
> SET(CMAKE_FIND_LIBRARY_PREFIXES "")
> SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
>
> ADD_DEFINITIONS(-Wall -Wno-sign-compare -O2)
>
> cmake_minimum_required(VERSION 2.6)
<snip>
>
> #############
> # wxWidgets #
> #############
>
> FIND_PACKAGE(wxWidgets)
> IF(wxWidgets_FOUND)
>  INCLUDE(${wxWidgets_USE_FILE})
> ELSE(wxWidgets_FOUND)
>  MESSAGE(FATAL_ERROR
>          "wxWidgets not found.")
> ENDIF(wxWidgets_FOUND)
>
> ADD_EXECUTABLE(acrls ${SRCS})
>
> TARGET_LINK_LIBRARIES(acrls ITKCommon ITKIO ${wxWidgets_LIBRARIES})

You can use the following, although this is unrelated to the above problem:

------
# no need for the if structure if using REQUIRED
FIND_PACKAGE(wxWidgets REQUIRED <libs needed>)
INCLUDE(${wxWidgets_USE_FILE})
...
TARGET_LINK_LIBRARIES(acrls ITKCommon ITKIO ${wxWidgets_LIBRARIES})
------

Hope this helps.

--Miguel


More information about the CMake mailing list