level-zero
level-zero copied to clipboard
logging: Allow to use spdlog from system if present
Some distributions (like Fedora) disallow fetching content from the internet build-time. Let's allow to link with spdlog from the host and use that if present during the build-time instead of content fetch.
This fails for me when using the system spdlog as if spdlog_FOUND is set then the system library is not added to the targets link libraries.
I can confirm @loqs, it does not fix the issue for me, which I have reported in https://github.com/oneapi-src/level-zero/issues/146
Some distributions (like Fedora) disallow fetching content from the internet build-time. Let's allow to link with spdlog from the host and use that if present during the build-time instead of content fetch.
Would moving from fetchcontent to a submodule make this any better? I presume it would since the submodule would get fetched before build-time.
Would moving from fetchcontent to a submodule make this any better? I presume it would since the submodule would get fetched before build-time.
Would you consider moving the fetch and build of spdlog / fmt to a submodule and allowing the use of the system libraries instead?
Would system libraries be used by default or optionally? What is the use case for using a system spdlog if we're submoduling our own?
As maintainer of level-zero in Gentoo Linux, I can say, that using system libs is a must. We don't allow using 3rd party libs to be included by a package except for some binary only packages. Packages are supposed to be compiled against system libs.
So please allow the usage of such libs. As you can see in #146, the changes are currently reverted as consequence.
Since Gentoo is source based, an optional compile option is fine @lisanna-dettwyler
You should bump the cmake_minimum_required. Bumping it to 3.21 will allow you to skip the find_package. The minimum of 3.2 is already broken with the usage of FetchContent.
One thing that's missing for this PR to work is the target_link_libraries (also remove target_include_directories since it doesn't match)
Replaced by https://github.com/oneapi-src/level-zero/pull/154 .