Поиск библиотек в глобальной области видимости

This commit is contained in:
Andrei Astafev 2021-07-06 05:24:41 +03:00
parent 2f3f45f2a0
commit 6b7220351e

View File

@ -1,40 +1,11 @@
function(enable_high_precision_math)
set(options QUAD MPFR)
set(oneValueArgs)
set(multiValueArgs)
cmake_parse_arguments(_PREFIX "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(_PREFIX_MPFR AND _PREFIX_QUAD)
message(FATAL_ERROR "Mutually exclusive options QUAD and MPFR")
endif()
if(_PREFIX_MPFR)
find_package(MPFR)
if(MPFR_FOUND)
find_package(MPFRCppThirdparty)
endif()
return()
endif()
if(_PREFIX_QUAD)
find_package(Quadmath)
if(QUADMATH_FOUND)
add_definitions(-DHAVE_QUADMATH=1)
endif()
return()
endif()
# Default
find_package(Quadmath)
if(QUADMATH_FOUND)
add_definitions(-DHAVE_QUADMATH=1)
find_package(Quadmath)
if(QUADMATH_FOUND)
add_definitions(-DHAVE_QUADMATH=1)
else()
find_package(MPFR)
if(MPFR_FOUND)
find_package(MPFRCppThirdparty)
else()
find_package(MPFR)
if(MPFR_FOUND)
find_package(MPFRCppThirdparty)
else()
message(FATAL_ERROR "Nor Quadmath, nor MPFR found.")
endif()
message(FATAL_ERROR "Nor Quadmath, nor MPFR found.")
endif()
endfunction()
endif()