cmake on mac fails with (missing: wxWidgets_LIBRARIES)

522 views
Skip to first unread message

Benjamin Stürmer

unread,
Jun 19, 2020, 1:47:41 AM6/19/20
to wx-users
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.

Benjamin Stürmer

unread,
Jun 19, 2020, 1:48:51 AM6/19/20
to wx-users
I also prepared a github sample with actions as a showcase:

Maarten Bent

unread,
Jun 19, 2020, 5:35:31 AM6/19/20
to wx-u...@googlegroups.com
Hi,

FindwxWidgets is part of CMake (https://cmake.org/cmake/help/latest/module/FindwxWidgets.html). It describes that wxWidgets_ROOT_DIR and wxWidgets_LIB_DIR are only use for Windows, on Unix systems the wx-config utility is used.

You have to make sure that CMake can find this utility. For example by adding (I think) 'installDir'/bin to the path, or setting a WX_CONFIG environment variable to 'installDir'/bin/wx-config', or calling CMake with -DCMAKE_FIND_ROOT_PATH='installDir'.

I hope one of these solutions helps,

Maarten

On 19 Jun 2020 07:48, Benjamin Stürmer wrote:
I also prepared a github sample with actions as a showcase:
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
 
To unsubscribe, send email to wx-users+u...@googlegroups.com
or visit http://groups.google.com/group/wx-users
---
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wx-users+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/c3d9e025-0074-443d-9b38-8d189e43aac1o%40googlegroups.com.

Benjamin Stürmer

unread,
Jun 29, 2020, 4:14:23 PM6/29/20
to wx-users
Thanks, seems like, I missed that point.

I can build it indeed with this param on mac:
-DCMAKE_FIND_ROOT_PATH=path/to/wxWidgets-3.1.3/

Am Freitag, 19. Juni 2020 11:35:31 UTC+2 schrieb Maarten Bent:
Hi,

FindwxWidgets is part of CMake (https://cmake.org/cmake/help/latest/module/FindwxWidgets.html). It describes that wxWidgets_ROOT_DIR and wxWidgets_LIB_DIR are only use for Windows, on Unix systems the wx-config utility is used.

You have to make sure that CMake can find this utility. For example by adding (I think) 'installDir'/bin to the path, or setting a WX_CONFIG environment variable to 'installDir'/bin/wx-config', or calling CMake with -DCMAKE_FIND_ROOT_PATH='installDir'.

I hope one of these solutions helps,

Maarten

On 19 Jun 2020 07:48, Benjamin Stürmer wrote:
I also prepared a github sample with actions as a showcase:
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
 
To unsubscribe, send email to wx-u...@googlegroups.com

or visit http://groups.google.com/group/wx-users
---
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wx-u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages