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