Description
Projects consuming ggml use find_package(ggml) in order to import the ggml::ggml target, which results in the installed version of cmake/ggml-config.cmake.in being processed by cmake.
In order to be able to consume ggml, comsumer source files #include <ggml.h>, which requires the ggml.h to be within an include path passed to the compiler. ggml-config.cmake assures the corresponding path to be passed to the compiler by assigning this path to the INTERFACE_INCLUDE_DIRECTORY cmake property for each installed backend in line 141 of the v0.10.0 version of the file, and each backend is then assigned to the ggml::ggml target in lines 175, 179 and 180.
If, however, the GGML_BACKEND_DL option was enabled when building ggml, lines 143 and 175 will not be processed over the condition in line 128, resulting in ggml::ggml being only ggml::ggml-base, which does not have an INTERFACE_INCLUDE_DIRECTORY property assigned to it.
Expectation
A third party project that was able to import ggml::ggml via find_package(ggml) should be able to use the ggml.h header file without having to search for it explicitly, even if ggml was not installed into a system directory. cmake handles the details as long as it can discover ggml-config.cmake on the system.
Solution
Assign the INTERFACE_INCLUDE_DIRECTORY property to ggml::ggml-base within a context that is independend on GGML_BACKEND_DL.
Description
Projects consuming ggml use
find_package(ggml)in order to import theggml::ggmltarget, which results in the installed version of cmake/ggml-config.cmake.in being processed by cmake.In order to be able to consume ggml, comsumer source files
#include <ggml.h>, which requires theggml.hto be within an include path passed to the compiler.ggml-config.cmakeassures the corresponding path to be passed to the compiler by assigning this path to theINTERFACE_INCLUDE_DIRECTORYcmake property for each installed backend in line 141 of the v0.10.0 version of the file, and each backend is then assigned to theggml::ggmltarget in lines 175, 179 and 180.If, however, the
GGML_BACKEND_DLoption was enabled when building ggml, lines 143 and 175 will not be processed over the condition in line 128, resulting inggml::ggmlbeing onlyggml::ggml-base, which does not have anINTERFACE_INCLUDE_DIRECTORYproperty assigned to it.Expectation
A third party project that was able to import
ggml::ggmlviafind_package(ggml)should be able to use theggml.hheader file without having to search for it explicitly, even if ggml was not installed into a system directory. cmake handles the details as long as it can discoverggml-config.cmakeon the system.Solution
Assign the
INTERFACE_INCLUDE_DIRECTORYproperty toggml::ggml-basewithin a context that is independend onGGML_BACKEND_DL.