问题
I compiled wxWidgets 2.8.12 using MinGW. To actually do the build I invoked the autotools build files distributed with wxWidgets through the MSYS shell, using an install prefix of H:\MinGW-libs.
The result of this is that I have a Unix style file tree containing my wxWidgets headers and libs (which are .a files, not .dll) with root directory H:\MinGW-libs.
My problem is that I can't get CMake to find the files. When I try to use the "configure" button in the CMake gui it finds other dependencies (namely boost, for which I had to specify BOOST_ROOT, but it does not find wxWidgets. I see that wxWidgets_ROOT_DIR is an available constant that I can set but none of the obvious choices
H:\MinGW-libs
(my install prefix for wxWidgets)
H:\MinGW-libs\lib
H:\MinGW-libs\include
fix the error.
There is an old post on the CMake mailing list about this issue but there isn't actually any information indicating how to fix it in this use case. The only hint I have is that there's a difference between looking for wxWidgets in "Unix style" file trees and "Windows style" file trees.
How can I get CMake to find wxWidgets installed in a Unix style file tree on Windows 7? Is there are way to get CMake to use wx-config? I ask this because from the MSYS command line using wx-config to get lib and header locations works just fine.
回答1:
From FindwxWidgets.cmake
:
if(WIN32 AND NOT CYGWIN AND NOT MSYS)
set(wxWidgets_FIND_STYLE "win32")
else()
if(UNIX OR MSYS)
set(wxWidgets_FIND_STYLE "unix")
endif()
endif()
So Unix-style tree is assumed for the "MSYS Makefiles" generator (cmake -G "MSYS Makefiles"
) but not for the "MinGW Makefiles" generator.
Which one do you use?
来源:https://stackoverflow.com/questions/18433305/cmake-find-wxwidgets-built-with-mingw-msys