cmake on mac fails with (missing: wxWidgets_LIBRARIES)

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
futuretrash
In need of some credit
In need of some credit
Posts: 6
Joined: Thu Jun 18, 2020 6:29 am

cmake on mac fails with (missing: wxWidgets_LIBRARIES)

Post by futuretrash » Thu Jun 18, 2020 6:39 am

I'm trying to use wxWidgets with cmake on mac so I had to build it from sources.

Code: Select all

git clone https://github.com/wxWidgets/wxWidgets
cd wxWidgets
mkdir build-cocoa-osx
cd build-cocoa-osx
../configure --enable-debug
make -j 8
make install
The installation was successful and I was able to build the samples and demos as well.

Code: Select all

./wx-config --cxxflags
  -I/..../wxWidgets/build-cocoa-debug/lib/wx/include/osx_cocoa-unicode-3.1 -I/..../wxWidgets/include -D_FILE_OFFSET_BITS=64 -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__
wx-config for libs

Code: Select all

./wx-config --libs
-L/..../wxWidgets/build-cocoa-debug/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

Code: Select all

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

Code: Select all

cmake -G "Unix Makefiles" -DwxWidgets_ROOT_DIR=/..../wxWidgets/build-cocoa-osx -DwxWidgets_LIB_DIR=/..../wxWidgets/build-cocoa-osx/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 /..../ as simplification for the users folder structure.
Last edited by futuretrash on Thu Jun 18, 2020 11:00 am, edited 1 time in total.

User avatar
doublemax
Moderator
Moderator
Posts: 15065
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: cmake on mac fails with (missing: wxWidgets_LIBRARIES)

Post by doublemax » Thu Jun 18, 2020 10:26 am

I don't work under OSX and i know even less about cmake, but are you sure this is right?

Code: Select all

-DwxWidgets_ROOT_DIR=/..../wxWidgets/build-cocoa-osx
Try without the /build-cocoa-osx/
Use the source, Luke!

futuretrash
In need of some credit
In need of some credit
Posts: 6
Joined: Thu Jun 18, 2020 6:29 am

Re: cmake on mac fails with (missing: wxWidgets_LIBRARIES)

Post by futuretrash » Thu Jun 18, 2020 11:04 am

@doublemax: The /..../ is only a simplification of the users folder structure. Or do you pertain on the / in the end?

User avatar
doublemax
Moderator
Moderator
Posts: 15065
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: cmake on mac fails with (missing: wxWidgets_LIBRARIES)

Post by doublemax » Thu Jun 18, 2020 11:31 am

futuretrash wrote:
Thu Jun 18, 2020 11:04 am
@doublemax: The /..../ is only a simplification of the users folder structure. Or do you pertain on the / in the end?
No, i meant the "build-cocoa-osx" part. My suggestion was to try just:

Code: Select all

-DwxWidgets_ROOT_DIR=/..../wxWidgets/
Use the source, Luke!

futuretrash
In need of some credit
In need of some credit
Posts: 6
Joined: Thu Jun 18, 2020 6:29 am

Re: cmake on mac fails with (missing: wxWidgets_LIBRARIES)

Post by futuretrash » Thu Jun 18, 2020 11:58 am

I tried multiple variants for wxWidgets_ROOT:

Code: Select all

-DwxWidgets_ROOT_DIR=/..../wxWidgets/build-cocoa-debug/lib
-DwxWidgets_ROOT_DIR=/..../wxWidgets/build-cocoa-debug
-DwxWidgets_ROOT_DIR=/..../wxWidgets
I tried the same diretories for wxWidgets_LIB_DIR as well.

futuretrash
In need of some credit
In need of some credit
Posts: 6
Joined: Thu Jun 18, 2020 6:29 am

Re: cmake on mac fails with (missing: wxWidgets_LIBRARIES)

Post by futuretrash » Thu Jun 18, 2020 2:09 pm

For better understanding, I published a sample project with github actions to build wxWidgets for osx:
https://github.com/thebino/HelloWxWidge ... /784521591

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4356
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: cmake on mac fails with (missing: wxWidgets_LIBRARIES)

Post by ONEEYEMAN » Thu Jun 18, 2020 6:17 pm

Hi,
Why not use a standard way of building under OSX - install and use Xcode?

Thank you.

futuretrash
In need of some credit
In need of some credit
Posts: 6
Joined: Thu Jun 18, 2020 6:29 am

Re: cmake on mac fails with (missing: wxWidgets_LIBRARIES)

Post by futuretrash » Thu Jun 18, 2020 7:45 pm

Building with xcode would force me to one platform, I don't need to use wxWidgets nor c++ for a single platform solution.
One of the biggest features of wxWidgets should be multiplatform support
wxWidgets is a C++ library that lets developers create applications for Windows, macOS, Linux and other platforms with a single code base.
Also it should be included in an already existing project based on cmake. So It has to be build with cmake.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4356
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: cmake on mac fails with (missing: wxWidgets_LIBRARIES)

Post by ONEEYEMAN » Thu Jun 18, 2020 7:53 pm

Hi,
While wxWidgets is a cross-platform C++ library, you will still suppose to build the library itself and then your code natively on the platform in question.
That's how C++ works comparing to "JAVA".
Are you trying to make the code to compile by the user of the software you're developing?
Or you (and your company) will distribute the binaries?

Thank you.

futuretrash
In need of some credit
In need of some credit
Posts: 6
Joined: Thu Jun 18, 2020 6:29 am

Re: cmake on mac fails with (missing: wxWidgets_LIBRARIES)

Post by futuretrash » Thu Jun 18, 2020 8:00 pm

Distribute the app as binary either with an installer and shared libs or as linked against static libs.
Right now I'm hesitating to use wxwidgets since these initial compile issues

User avatar
doublemax
Moderator
Moderator
Posts: 15065
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: cmake on mac fails with (missing: wxWidgets_LIBRARIES)

Post by doublemax » Thu Jun 18, 2020 8:05 pm

Cmake support in wxWidgets is relatively new and - as far as i can tell - rarely used.

Try posting on the wx-users group where you can reach the core developers. This is a user forum.
https://groups.google.com/forum/#!forum/wx-users
Use the source, Luke!

Post Reply