FEniCS/basix

Manage CMake finding of xtensor

Closed this issue · 3 comments

At the moment we're using the CMake feature FetchContent to get the header-only xtensor dependencies. It's unclear how this might work if the dependencies are already available. We should configure so that installed version can be used if available.

I guess you can run

find_package(xtl REQUIRED)
find_package(xtensor REQUIRED)
find_package(xtensor-blas REQUIRED)

first, and then proceed to the FetchContent_Declare blocks conditionally, based on the values of xtl_FOUND, xtensor_FOUND, etc.

This patch seems to cover it, for instance.
use_system_xtl_xtensor.txt

I've placed the patch (with improvements) into PR #163 .

cmake 3.19 allows a version range to be specified, but not all systems have it installed so I made that conditional.