我的CMakeLists.txt中有以下代码段,如wxWidgets维基中所述
set(wxWidgets_ROOT_DIR libs/wxWidgets)
set(wxWidgets_CONFIGURATION mswu)
find_package(wxWidgets REQUIRED
COMPONENTS core base adv)
include(${wxWidgets_USE_FILE})
libs/wxWidgets
是一个git子模块。在Ubuntu16.04上,该项目构建并工作。子模块说明如下:
[submodule "libs/wxWidgets"]
path = libs/wxWidgets
url = https://github.com/wxWidgets/wxWidgets
branch = WX_3_0_3_BRANCH
但是,在Windows上使用相同的代码不起作用,错误如下:
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES
wxWidgets_INCLUDE_DIRS)
Call Stack (most recent call first):
C:/Program Files (x86)/CMake/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:377 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files (x86)/CMake/share/cmake-3.9/Modules/FindwxWidgets.cmake:953 (find_package_handle_standard_args)
CMakeLists.txt:8 (find_package)
其他来自官方网站的官方网站安装(包括zip
和Windows Installer
)也尝试过,但也出现了相同的错误。
这个问题可能是相关的,但它没有可接受的答案。
发布于 2022-10-22 07:05:16
尝试使用以下代码:
set(wxWidgets_DIR "path/to/wxWidgets/lib/cmake/wxWidgets")
find_package(wxWidgets REQUIRED core base CONFIG) #Don't forget to add this 'CONFIG'
include(UsewxWidgets)
这在wxWidgets 3.2.1中适用于我
https://stackoverflow.com/questions/46555129
复制相似问题