Cannot Find WxWidgets On MacOS
I have Cmake 3.13.0, and I am compiling WxWidgets 3.1.2 on MacOS 10.14. I followed this guide when I was compiling wxWidgets, and was following the starter guide for WxWidgets when I encountered an error. I was told to find the package, include it, and link the libraries in my CMakeLists.txt, which I did, leading to the error here:
jmbp:build john$ cmake -G Ninja .. CMake Error at /Applications/CMake.app/Contents/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message): Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES) Call Stack (most recent call first): /Applications/CMake.app/Contents/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE) /Applications/CMake.app/Contents/share/cmake-3.13/Modules/FindwxWidgets.cmake:963 (find_package_handle_standard_args) CMakeLists.txt:9 (find_package) -- Configuring incomplete, errors occurred! See also "/Users/john/Desktop/guitest/build/CMakeFiles/CMakeOutput.log".
My /usr/local/include and /usr/local/lib are both populated with wx include files and libraries from make install, and my unzipped folder is in Downloads. I tried troubleshooting myself, but didn't work.
This is my CMakeLists.txt:
cmake_minimum_required (VERSION 2.6)
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_FIND_LIBRARY_PREFIXES 'lib')
set (CMAKE_FIND_LIBRARY_SUFFIXES '.dylib')
set (wxWidgets_ROOT_DIR "/usr/local")
set (wxWidgets_LIB_DIR "/usr/local/lib")
set (wxWidgets_LIBRARIES "${wxWidgets_LIB_DIR}")
set (wxWidgets_INCLUDE_DIRS "/usr/local/include/wx")
find_package(wxWidgets REQUIRED)
include(${wxWidgets_USE_FILE})
project (guitest)
add_executable(guitest guitestmain.cpp)
target_link_libraries(guitest ${wxWidgets_LIBRARIES})
And this is my guitestmain.cpp:
#include <wx/wxprec.h> #ifndef WX_PRECOMP #include <wx/wx.h> #endif using namespace std; class MyApp: public wxApp{ public: virtual bool OnInit(); };
What is causing this problem, what and to what should I set the in CMakeLists, and how do I solve the problem?