Cmake Could not find wxWigets

ぐ巨炮叔叔 提交于 2020-07-09 16:51:35

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/48945965/cmake-could-not-find-wxwigets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!