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 via email to