milk-org / milk

Modular Image processing Library toolKit (milk) :telescope:
https://milk-org.github.io/milk/
6 stars 10 forks source link

Adding configuration such that CMake find_package can also find the installed package. #30

Closed stefi07 closed 2 months ago

stefi07 commented 3 months ago

Export all libraries to milkTargets.cmake, which gets installed in lib/cmake (following pkgconfig). Also create milk_all alias for a collective target that would include all libraries in client project. Generate milkConfigVersion.cmake and milkConfig.cmake, which are also installed in lib/cmake.

DasVinch commented 2 months ago

Hi @stefi07 , thanks a lot for your contribution (I'll take a deeper look asap)! Can you clarify what is the intended goal? Faster, more modular install, or am I missing something?

stefi07 commented 2 months ago

Hi @DasVinch, thanks for considering my contribution.

The existing install procedure for milk creates a pkgconf dir with .pc files that allow pkg-conf to retrieve information about the installed library. In a CMakeLists.txt file, however, this requires first to call find_package on PkgConfig (i.e. including the line find_package(PkgConfig REQUIRED)).

This PR (and the symmetrical one for ImageStreamIO) adds direct support for CMake’s find_package (https://cmake.org/cmake/help/v3.0/command/find_package.html) by adding to the install procedure the creation of .cmake config files that are installed in a cmake dir (in the same parent dir as the pkgconf dir). With find_package the library is included as an imported target, which makes it easier to manage dependencies downstream.

DasVinch commented 2 months ago

Looks good to me! Just holding on the ISIO PR.