Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cmake Could not find wxWigets

I want to compile a source code on windows using CMake, it uses wxWigets library. I downloaded the wxWigets from the page: https://www.wxwidgets.org/

After building by Visual Studio, I got the library /lib file. I have already set PATH for wxWidgets_LIBRARIES and wxWidgets_INCLUDE_DIRS. But the following errors cannot be resolved.

CMake Error at C:/Program Files/CMake/share/cmake-3.11/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
      Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES
      wxWidgets_INCLUDE_DIRS)
    Call Stack (most recent call first):
      C:/Program Files/CMake/share/cmake-3.11/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
      C:/Program Files/CMake/share/cmake-3.11/Modules/FindwxWidgets.cmake:953 (find_package_handle_standard_args)
      CMakeLists.txt:52 (find_package)

I also read the thread about this problem in: CMake could not find wxWidgets on Windows But there is no solution for my case.

like image 695
Karim Avatar asked Oct 26 '25 01:10

Karim


1 Answers

You may specify wxWidgets_ROOT_DIR variable to point to your wxWidgets installation.

As far as I understand, you may set either CMake variable via -D option to cmake:

cmake -DwxWidgets_ROOT_DIR:PATH=D:/path/to/wxWidgets/ ...

or you may set environment variable

set wxWidgets_ROOT_DIR=D:\path\to\wxWidgets\ ...

(Note that CMake path variables use "universal" directory separator '/', but environment variables use native directory separator, '\' for Windows).

This variable is described in documentation for FindwxWidget.


Using wxWidgets_LIB_DIR variable could be tricky, see that question.

like image 86
Tsyvarev Avatar answered Oct 27 '25 16:10

Tsyvarev