CMake cannot find wxwidgets 3.1

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
Matael
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Jun 16, 2017 9:48 am

CMake cannot find wxwidgets 3.1

Post by Matael » Thu Jun 22, 2017 1:28 pm

Hi all!

I'me getting some troubles when trying to use wxWidgets 3.1. I'm working on Linux Mint, and I compiled the code from github.

I did:
../configure && make && sudo make install

Previously, I installed wxWidgets 3.0.2 from "apt" and it's still installed

When I specified in my CMakeLists

Code: Select all

find_package(wxWidgets 3.1 REQUIRED)
I've got the following error :

Code: Select all

Could NOT find wxWidgets: Found unsuitable version "3.0.2", but required is at least "3.1"
3.0.2 is installed in /usr/lib/x86_64-linux-gnu/
3.1.1 is installed in the directory I build it and in /usr/local/lib/

I tried a lot of things, but probably not the ggod way (target_link_libraries(...), set(wxWidgets_CONFIG_OPTIONS ...), list(...), add(...) and others.
I'm pretty sure it's quite simple but I really don't know how to do that. If possible, I want CMake to search in the directory I build it

Thank's all!
<3

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

Re: CMake cannot find wxwidgets 3.1

Post by ONEEYEMAN » Thu Jun 22, 2017 4:34 pm

Hi,
Try this:
1. sudo apt-get remove --purge wxWidgets-3.0.2
2. cd wxWidgets-3.1/buildGTK
3. sudo make install
4. sudo ldconfig

1. Will remove everything off of wxWidgets-3.0.2
2. and 3. Will reinstall wxWidgets-3.1
4. Will make sure that the linker will find the appropriate libraries.

User avatar
marcelinux
Knows some wx things
Knows some wx things
Posts: 40
Joined: Thu Nov 07, 2013 9:59 pm
Location: Madrid, Spain

Re: CMake cannot find wxwidgets 3.1

Post by marcelinux » Fri Jun 23, 2017 6:24 am

Or...

Code: Select all

/full/path/to/that/wx-config --version
See https://wiki.wxwidgets.org/Compiling_an ... ng_started

Good luck
I just need learn a little bit more. Thank you for your help.

Matael
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Jun 16, 2017 9:48 am

Re: CMake cannot find wxwidgets 3.1

Post by Matael » Fri Jun 23, 2017 7:46 am

Hi!

@ONEEYEMAN I already did this, but I tried it again (just in case) and cmake tell me nothing is found for wxWidget

@marcelinux I tried wx-config --version (without the path) and I get 3.1.1

I followed the entire wiki-link given by marcelinux, samples are working, so I think it's just cmake which don't find it

=)

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2569
Joined: Sun Jan 03, 2010 5:45 pm

Re: CMake cannot find wxwidgets 3.1

Post by PB » Fri Jun 23, 2017 8:53 am

I do not use Linux, but perhaps the information about setting CMake variables and wx-config-related options, listed in the CMake'sFindwxWidgets module can be of some help: https://gitlab.kitware.com/cmake/cmake/ ... .cmake#L38. But I'm not even sure if the module is actually used on Linux and not only on MSW...

Matael
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Jun 16, 2017 9:48 am

Re: CMake cannot find wxwidgets 3.1

Post by Matael » Fri Jun 23, 2017 1:25 pm

I get the gitlab version of cmake around 1h ago, but it's still not working =)

Is there really nobody who success to use cmake and the newest wxwidgets? (at least 3.1.0)

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

Re: CMake cannot find wxwidgets 3.1

Post by ONEEYEMAN » Fri Jun 23, 2017 1:55 pm

That's why CMake sucks. ;-)
People mostly use wx-config script to compile their software. They use CMake to some extent to compile the library itself,

There are not too many people that have a setup like yours.

Thank you,

Matael
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Jun 16, 2017 9:48 am

Re: CMake cannot find wxwidgets 3.1

Post by Matael » Fri Jun 23, 2017 2:07 pm

haha ;-) (my entire code is too cpmlex to be compiled manually (using RS232 comunication, database, and other ;-) )

glad for them but sad for me ;-)

thank you =)

DavidHart
Site Admin
Site Admin
Posts: 4005
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: CMake cannot find wxwidgets 3.1

Post by DavidHart » Fri Jun 23, 2017 2:59 pm

Hi,

CodeLite uses cmake and wx3.1, but instead of using find_package it locates it by hand. The code is here starting at line 118.

You'll see that a user can optionally pass -DWITH_WXPATH=<fullpath> to select a particular wx-config.

Regards,

David

Matael
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Jun 16, 2017 9:48 am

Re: CMake cannot find wxwidgets 3.1

Post by Matael » Tue Jun 27, 2017 2:32 pm

Hi!

Thank you very much !
I can compile now!

Is it a good idea to put what the cmake is looking here? I can't keep it in my code. I did a plugin for OpenCPN, but it's not supporting wxWidgets 3.1 yet, so I have to wait, and when OpenCPN will support 3.1, cmake shall support it too, maybe, so I will remove it from my code =)

gunterkoenigsmann
Earned a small fee
Earned a small fee
Posts: 13
Joined: Tue May 31, 2016 11:30 am

Re: CMake cannot find wxwidgets 3.1

Post by gunterkoenigsmann » Fri Apr 26, 2019 6:07 am

Sometimes removing CMakeCache.txt resolves this kind of problem...

unxed
In need of some credit
In need of some credit
Posts: 9
Joined: Mon Dec 09, 2019 8:48 pm

Re: CMake cannot find wxwidgets 3.1

Post by unxed » Mon Aug 03, 2020 4:43 pm

Similar issue on Linux Mint 20 (solved).

User avatar
conleec
Earned a small fee
Earned a small fee
Posts: 10
Joined: Wed Aug 22, 2018 4:19 pm
Location: Los Angeles
Contact:

Re: CMake cannot find wxwidgets 3.1

Post by conleec » Sun Sep 27, 2020 6:27 am

I successfully build the samples with CLion and CMake a while back. Some of what I learned may be relevant to you. You can find it here:
viewtopic.php?p=197038#p187276
---------------------------
Chris Conlee
wxWidgets Learner
CLion 2918.2.5 / CMake 3.12
wxWidgets 3.1.1

Post Reply