I'm trying to use wxWidgets in a multiplatform project wich is using cmake.
To use it on osx I tried to build it from sources and failed:
git clone https://github.com/wxWidgets/wxWidgets
cd wxWidgets
mkdir build-cocoa-osx
cd build-cocoa-osx
../configure --enable-debug --prefix=/wxWidgets-3.1.3
make -j 8
make install
The installation was successful and I was able to build the samples and demos as well.
-I/wxWidgets-3.1.3/lib/wx/include/osx_cocoa-unicode-3.1 -I/wxWidgets-3.1.3/include/wx-3.1 -D_FILE_OFFSET_BITS=64 -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__
wx-config for libs
-L/wxWidgets-3.1.3/lib -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL -lwx_osx_cocoau_xrc-3.1 -lwx_osx_cocoau_html-3.1 -lwx_osx_cocoau_qa-3.1 -lwx_osx_cocoau_core-3.1 -lwx_baseu_xml-3.1 -lwx_baseu_net-3.1 -lwx_baseu-3.1
In the CMakeLists.txt I added
find_package(wxWidgets REQUIRED core base HINT ${wxWidgets_ROOT_DIR})
message(STATUS "wxWidgets library:")
But when I run cmake on my project with the following command
cmake -G "Unix Makefiles" -DwxWidgets_ROOT_DIR=/wxWidgets-3.1.3 -DwxWidgets_LIB_DIR=/wxWidgets-3.1.3/lib . -B build
CMake Error at /usr/local/Cellar/cmake/3.17.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES)
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.17.3/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:445 (_FPHSA_FAILURE_MESSAGE)
/usr/local/Cellar/cmake/3.17.3/share/cmake/Modules/FindwxWidgets.cmake:1008 (find_package_handle_standard_args)
CMakeLists.txt:66 (find_package)
* I used /wxWidgets-3.1.3 as simplification for the users folder structure. It is not placed in the root directory.