@@ -71,7 +71,18 @@ if(pugixml_FOUND)
7171else ()
7272 message (STATUS "Did not find pugixml, will use submodule instead" )
7373endif ()
74-
74+ find_package (xtensor QUIET NO_SYSTEM_ENVIRONMENT_PATH )
75+ if (xtensor_FOUND)
76+ message (STATUS "Found xtensor: ${xtensor_DIR} (version ${xtensor_VERSION} )" )
77+ else ()
78+ message (STATUS "Did not find xtensor, will use submodule instead" )
79+ endif ()
80+ find_package (gsl-lite QUIET NO_SYSTEM_ENVIRONMENT_PATH )
81+ if (gsl-lite_FOUND)
82+ message (STATUS "Found gsl-lite: ${gsl-lite_DIR} (version ${gsl-lite_VERSION} )" )
83+ else ()
84+ message (STATUS "Did not find gsl-lite, will use submodule instead" )
85+ endif ()
7586#===============================================================================
7687# libMesh Unstructured Mesh Support
7788#===============================================================================
@@ -211,19 +222,23 @@ if (NOT (CMAKE_VERSION VERSION_LESS 3.13))
211222 cmake_policy (SET CMP0079 NEW )
212223endif ()
213224
214- add_subdirectory (vendor/xtl )
215- set (xtl_DIR ${CMAKE_CURRENT_BINARY_DIR } /vendor/xtl)
216- add_subdirectory (vendor/xtensor )
225+ if (NOT xtensor_FOUND)
226+ add_subdirectory (vendor/xtl )
227+ set (xtl_DIR ${CMAKE_CURRENT_BINARY_DIR } /vendor/xtl)
228+ add_subdirectory (vendor/xtensor )
229+ endif ()
217230
218231#===============================================================================
219232# GSL header-only library
220233#===============================================================================
221234
222- add_subdirectory (vendor/gsl-lite )
235+ if (NOT gsl-lite_FOUND)
236+ add_subdirectory (vendor/gsl-lite )
223237
224- # Make sure contract violations throw exceptions
225- target_compile_definitions (gsl-lite-v1 INTERFACE GSL_THROW_ON_CONTRACT_VIOLATION )
226- target_compile_definitions (gsl-lite-v1 INTERFACE gsl_CONFIG_ALLOWS_NONSTRICT_SPAN_COMPARISON=1 )
238+ # Make sure contract violations throw exceptions
239+ target_compile_definitions (gsl-lite-v1 INTERFACE GSL_THROW_ON_CONTRACT_VIOLATION )
240+ target_compile_definitions (gsl-lite-v1 INTERFACE gsl_CONFIG_ALLOWS_NONSTRICT_SPAN_COMPARISON=1 )
241+ endif ()
227242
228243#===============================================================================
229244# RPATH information
@@ -422,7 +437,13 @@ endif()
422437# target_link_libraries treats any arguments starting with - but not -l as
423438# linker flags. Thus, we can pass both linker flags and libraries together.
424439target_link_libraries (libopenmc ${ldflags} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES}
425- pugixml faddeeva xtensor gsl-lite-v1 fmt::fmt )
440+ faddeeva xtensor gsl::gsl-lite-v1 fmt::fmt )
441+
442+ if (TARGET pugixml::pugixml)
443+ target_link_libraries (libopenmc pugixml::pugixml )
444+ else ()
445+ target_link_libraries (libopenmc pugixml )
446+ endif ()
426447
427448if (dagmc)
428449 target_compile_definitions (libopenmc PRIVATE DAGMC )
0 commit comments