How to find GTK3 in CMake

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to find GTK3 in CMake

Harry Mallon-2
Hi,

FindGTK and FindGTK2 exist in the CMake tree. How come there isn't one for GTK3? Should the GTK2 one work, or is there another way?

Harry


Harry Mallon
Senior Software Engineer
T+44 203 7000 989 
60 Poland Street | London | England | W1F 7NT  


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: How to find GTK3 in CMake

David Demelier-2
Le 20/11/2018 à 17:03, Harry Mallon a écrit :
> Hi,
>
> FindGTK and FindGTK2 exist in the CMake tree. How come there isn't one for GTK3? Should the GTK2 one work, or is there another way?

GNOME people don't like CMake (they use meson). The philosophy behind
CMake is to let upstream projects provides their own CMake configuration
packages rather than providing Find modules for every single library
existing in the world.

CMake should already not provide any of these, but this general
recommendation came after.

It's the same thing for pkg-config, pkg-config by itself does not
provide any .pc file.

Also, Gtk is much more tied to Linux than being portable. I think that's
why portable software don't use Gtk that much and thus, not CMake either.

Regards,

--
David
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: How to find GTK3 in CMake

Jan Wielemaker
On 21/11/2018 09:46, David Demelier wrote:
> The philosophy behind CMake is to let upstream projects provides their
> own CMake configuration packages rather than providing Find modules for
> every single library existing in the world.
>
> CMake should already not provide any of these, but this general
> recommendation came after.
>
> It's the same thing for pkg-config, pkg-config by itself does not
> provide any .pc file.

Good. I was already considering providing a cmake file after migrating
SWI-Prolog to cmake. Are there good guidelines for this? Pkg-config asks
for providing a .pc file and installing in a well-known place. Is there
a similar place for project cmake `find' files or some other convention
to make them available to users?

While porting SWI-Prolog I typically searched for FindXYZ and when in
the CMake dir, I just included this (always?) without trouble. If not I
searched the web and copied one. Most came from other projects also
trying to use the target library. It is not uncommon to find several
files, some copies, some good, some bad (outdated ways to find stuff,
local installation specific, poor cross-platform support, etc). This
wasn't the best part of the experience and I ended up (re-)writing
several Find* from scratch while still being an inexperienced CMake
user (so most are not good either) :(

This is similar autoconf, where the bundled tests are typically high
quality and the repositories and other projects locally provided tests
are often not.

Still a happy cmake user :)

        Cheers --- Jan
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: How to find GTK3 in CMake

Eric Noulard
In reply to this post by David Demelier-2


Le mer. 21 nov. 2018 à 09:46, David Demelier <[hidden email]> a écrit :
Le 20/11/2018 à 17:03, Harry Mallon a écrit :
> Hi,
>
> FindGTK and FindGTK2 exist in the CMake tree. How come there isn't one for GTK3? Should the GTK2 one work, or is there another way?

GNOME people don't like CMake (they use meson). The philosophy behind
CMake is to let upstream projects provides their own CMake configuration
packages rather than providing Find modules for every single library
existing in the world.

Right and the fact is even traced here: https://gitlab.kitware.com/cmake/cmake/issues/15888

 

CMake should already not provide any of these, but this general
recommendation came after.

It's the same thing for pkg-config, pkg-config by itself does not
provide any .pc file.

Also, Gtk is much more tied to Linux than being portable. I think that's
why portable software don't use Gtk that much and thus, not CMake either.

Some project nevertheless uses GTK3 and CMake so that you may borrow hopefully working
FindGTK3.cmake module from them:
E.g.
Darktable:
WebKit:

and probably many others.
--
Eric

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: How to find GTK3 in CMake

David Demelier-2
In reply to this post by Jan Wielemaker
Le 21/11/2018 à 10:19, Jan Wielemaker a écrit :
> Good. I was already considering providing a cmake file after migrating
> SWI-Prolog to cmake. Are there good guidelines for this? Pkg-config asks
> for providing a .pc file and installing in a well-known place. Is there
> a similar place for project cmake `find' files or some other convention
> to make them available to users?

Yes, it requires a little bit of boilerplate as CMake is a bit more
extensive than pkg-config.

https://cmake.org/cmake/help/v3.12/manual/cmake-packages.7.html#creating-packages

Note: lot of things are optional, this guide shows everything you can do
with provided package.

But the minimal required is:

1. install(TARGETS yourlibrary EXPORT yourlibrary-targets)
2. install(EXPORT yourlibrary-targets FILE yourlibrary-targets.cmake
NAMESPACE yourlibrary DESTINATION lib/cmake/yourlibrary)
3. install(FILES yourlibrary-config.cmake DESTINATION lib/cmake/yourlibrary)

And create yourlibrary-config.cmake with

include("${CMAKE_CURRENT_LIST_DIR}/yourlibrary-targets.cmake")

Regards

--
David
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: How to find GTK3 in CMake

Harry Mallon-2
In reply to this post by Harry Mallon-2

Hi again,

 

Thanks David and Eric. I have actually used cmake’s pkgconfig integration to support this library. As you say (about it not being very portable) I only needed it on Linux so pkgconfig is a reasonable thing to use.

 

Thanks,

Harry

 

Harry Mallon

Senior Software Engineer

T <A id=c1-id-17 style="TEXT-DECORATION: none; COLOR: gray" href="callto:+44 203 7000 989">+44 203 7000 989 

60 Poland Street | London | England | W1F 7NT

A Star is Born Halloween 13 Reasons Why



--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake