ci: fmt dependency checked only when UNITS_USE_LIBFMT is set

This commit is contained in:
Mateusz Pusz
2022-08-02 15:10:21 +02:00
parent 6557647ce9
commit 9944de10f9

View File

@@ -30,6 +30,7 @@ function(__check_libcxx_in_use variable)
set(${variable} ${${variable}} PARENT_SCOPE)
list(POP_BACK CMAKE_MESSAGE_INDENT)
if(${variable})
message(CHECK_PASS "found")
else()
@@ -39,15 +40,21 @@ function(__check_libcxx_in_use variable)
endfunction()
include(CMakeFindDependencyMacro)
if(UNITS_USE_LIBFMT)
find_dependency(fmt)
endif()
find_dependency(gsl-lite)
# add range-v3 dependency only for clang + libc++
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
__check_libcxx_in_use(__units_libcxx)
if(__units_libcxx AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "14")
find_dependency(range-v3)
endif()
unset(__units_libcxx)
endif()