From 01117b10ffa027423906cd7bf801b24d3be92ca2 Mon Sep 17 00:00:00 2001 From: Kalin Kiesling Date: Tue, 15 Mar 2022 10:43:22 -0500 Subject: [PATCH] use xtensor library on system if it already exists, else use vendored submodule --- CMakeLists.txt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a01d02fb3..1e514e32b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,7 +71,12 @@ if(pugixml_FOUND) else() message(STATUS "Did not find pugixml, will use submodule instead") endif() - +find_package(xtensor QUIET NO_SYSTEM_ENVIRONMENT_PATH) +if(xtensor_FOUND) + message(STATUS "Found xtensor: ${xtensor_DIR} (version ${xtensor_VERSION})") +else() + message(STATUS "Did not find xtensor, will use submodule instead") +endif() #=============================================================================== # libMesh Unstructured Mesh Support #=============================================================================== @@ -211,9 +216,11 @@ if (NOT (CMAKE_VERSION VERSION_LESS 3.13)) cmake_policy(SET CMP0079 NEW) endif() -add_subdirectory(vendor/xtl) -set(xtl_DIR ${CMAKE_CURRENT_BINARY_DIR}/vendor/xtl) -add_subdirectory(vendor/xtensor) +if (NOT xtensor_FOUND) + add_subdirectory(vendor/xtl) + set(xtl_DIR ${CMAKE_CURRENT_BINARY_DIR}/vendor/xtl) + add_subdirectory(vendor/xtensor) +endif() #=============================================================================== # GSL header-only library