[CMake] How to find GTK3 in CMake
David Demelier
markand at malikania.fr
Wed Nov 21 04:36:09 EST 2018
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
More information about the CMake
mailing list