0

I've tried to link wxWidgets 3.0.2 to my C++ project but CMake can't seem to find it.

The wxWidgets that I'm trying to get CMake to find is from wxMSW-Setup-3.0.2.exe

This is the error it gives me:

-- Building for: Visual Studio 12 2013
CMake Error at D:/Program Files (x86)/CMake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
    Could NOT find wxWidgets (missing: wxWidgets_FOUND)
Call Stack (most recent call first):
    D:/Program Files (x86)/CMake/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
    D:/Program Files (x86)/CMake/share/cmake-3.3/Modules/FindwxWidgets.cmake:871 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
    CMakeLists.txt:66 (find_package)


-- Configuring incomplete, errors occurred!

CMakeLists.txt:66 refers to this line:

find_package(wxWidgets REQUIRED core base)

I've tried changing the CMake generator, and running set(wxWidgets_ROOT_DIR "C:/wxWidgets-3.0.2"), both of which didn't fix the problem.

CMake is version 3.3.1.

Ðаn
  • 10,934
  • 11
  • 59
  • 95
octopod
  • 824
  • 2
  • 10
  • 23
  • Try `cmake -DCMAKE_PREFIX_PATH="C:/wxWidgets-3.0.2"`. Accordint to [the documentation](http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_PREFIX_PATH.html) it specifies `path used for searching by FIND_XXX()...`. – Gluttton Sep 11 '15 at 13:37
  • @Gluttton it still gives me the same error. – octopod Sep 11 '15 at 14:10
  • Try going deeper into `C:/wxWidgets-3.0.2`. – Gluttton Sep 11 '15 at 14:12

2 Answers2

0

I think cmake used environement variable to find wxwidgets. You have to set wxDir or wxWin variable to C:/wxWidgets-3.0.2

LBerger
  • 593
  • 2
  • 12
0

Use find_package(wxWidgets REQUIRED gl core base OPTIONAL_COMPONENTS net) instead of find_package(wxWidgets REQUIRED COMPONENTS core base). And when you build the wxWidgets https://wiki.wxwidgets.org/Compiling_wxWidgets_with_MinGW, use build the static libraries instead of dynamic libraries, I fixed it by using these two steps.

Youshikyou
  • 365
  • 1
  • 8