Search code examples
cmakewxwidgets

wxWidgets CMake Windows Setup Troubles


I am really struggling to setup wxWidgets to work on Windows and CMake and would appreciate some help.

I have downloaded wxWidgets 3.1.4, run the setup (which extracted to C:\CPP_lib\wxWidgets) and then ran the following commands in the terminal:

cd C:\CPP_lib
mkdir wxWidgets-install
cmake C:\CPP_lib\wxWidgets -DCMAKE_INSTALL_PREFIX=C:\CPP_lib\wxWidgets-install -DwxBUILD_SHARED=OFF
cd wxWidgets-install
cmake --build . --target install

I have environment variables CMAKE_PREFIX_PATH set to C:\CPP_lib and wxWidgets_DIR and wxWidgets_ROOT_DIR both set to C:\CPP_lib\wxWidgets-install.

However, when I have a simple CMake project that calls find_package(wxWidgets), I get the following message in the terminal:

Found wxWidgets: winmm;comctl32;uuid;oleacc;uxtheme;rpcrt4;shlwapi;version;wsock32
missing components: core base png tiff jpeg zlib regex expat

Please help - I have been struggling for a while now :(


Solution

  • It turns out the issue was a very specific one related to vcpkg.

    I had pointed CMake to my vcpkg toolchain file (even though wxWidgets was installed independent of vcpkg) and this was causing issues with finding wxWidgets i.e. vcpkg was preventing wxWidgets (a non-vcpkg installation) from being found.

    I believe this is a vcpkg bug, although am not sure, but have reported it anyways.