- 1 year ago
Cmake Could not find wxWigets
Comment
1 / 1
If CMake is unable to find the wxWidgets library, you need to specify the location of wxWidgets library files to CMake using the CMAKE_PREFIX_PATH
or wxWidgets_ROOT_DIR
variables. Here's how you can do it:
- Set the
CMAKE_PREFIX_PATH
variable in your CMakeLists.txt file:
cmakeset(CMAKE_PREFIX_PATH "/path/to/wxWidgets/installation")
Replace "/path/to/wxWidgets/installation" with the actual path where wxWidgets is installed on your system.
- Set the
wxWidgets_ROOT_DIR
variable in your CMakeLists.txt file:
cmakeset(wxWidgets_ROOT_DIR "/path/to/wxWidgets/installation")
Again, replace "/path/to/wxWidgets/installation" with the actual path where wxWidgets is installed on your system.
- You can also set the
CMAKE_PREFIX_PATH
variable when running CMake from the command line:
bashcmake -DCMAKE_PREFIX_PATH="/path/to/wxWidgets/installation" /path/to/source
- Alternatively, you can set the
wxWidgets_ROOT_DIR
variable when running CMake from the command line:
bashcmake -DwxWidgets_ROOT_DIR="/path/to/wxWidgets/installation" /path/to/source
Remember to replace "/path/to/wxWidgets/installation" with the actual path where wxWidgets is installed on your system.
After setting the correct path to wxWidgets, CMake should be able to find the library, and you should no longer see the "Could not find wxWidgets" error.