[CMake] How to produce a -config.cmake file

Thompson, KT kgt at lanl.gov
Thu Sep 27 10:30:33 EDT 2018


Matthieu,

I think are asking about the CMakePackageConfigHelpers CMake module (https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html) that defines the macro 'configure_package_config_file'.

You can probably find several tutorials or examples by searching github or stackoverflow, etc. for 'CMakePackageConfigHelpers'.  It is also covered in some detail in the e-book "Professional CMake" by Craig Scott (requires a purchase).

-kt

From: CMake <cmake-bounces at cmake.org> On Behalf Of Dorier, Matthieu
Sent: Thursday, September 27, 2018 2:42 AM
To: cmake at cmake.org
Subject: [CMake] How to produce a -config.cmake file


Hi,



I'm using cmake to build a library (damaris). Once installed, I would like users to be able to find it and its dependencies using find_package(damaris). If I understand correctly, the way to do that is to have cmake create and install a "damaris-config.cmake" file.



Is there a tutorial somewhere on how to do that?



Here is some more information:

the library depends on

- Boost (using the default FindBoost.cmake installed with cmake)

- XercesC (using a custom FindXercesC.cmake located in my source tree)

- XSD (using a custom FindXSD.cmake as well)

Additionally, it may have been built with the following optional dependencies:

- CppUnit (using a custom FindCppUnit.cmake)

- HDF5 (using the default FindHDF5.cmake shipped with cmake)

- VisIt (using a custom FindVisIt.cmake)

- ParaView (relying on the ParaViewConfig.cmake produced when installing ParaView).



Thanks,



Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180927/773d1317/attachment-0001.html>


More information about the CMake mailing list