[CMake] How to find GTK3 in CMake

Jan Wielemaker jan at swi-prolog.org
Wed Nov 21 04:19:03 EST 2018


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


More information about the CMake mailing list