2021-07-06 01:40:23 +00:00
|
|
|
function(enable_high_precision_math)
|
|
|
|
set(options QUAD MPFR)
|
|
|
|
set(oneValueArgs)
|
|
|
|
set(multiValueArgs)
|
|
|
|
|
2021-07-06 01:54:20 +00:00
|
|
|
cmake_parse_arguments(_PREFIX "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
2021-07-06 01:40:23 +00:00
|
|
|
|
2021-07-06 01:54:20 +00:00
|
|
|
if(_PREFIX_MPFR AND _PREFIX_QUAD)
|
2021-07-06 01:40:23 +00:00
|
|
|
message(FATAL_ERROR "Mutually exclusive options QUAD and MPFR")
|
|
|
|
endif()
|
|
|
|
|
2021-07-06 01:54:20 +00:00
|
|
|
if(_PREFIX_MPFR)
|
2021-07-06 01:40:23 +00:00
|
|
|
find_package(MPFR)
|
|
|
|
if(MPFR_FOUND)
|
|
|
|
find_package(MPFRCppThirdparty)
|
|
|
|
endif()
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2021-07-06 01:54:20 +00:00
|
|
|
if(_PREFIX_QUAD)
|
2021-07-06 01:40:23 +00:00
|
|
|
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)
|
|
|
|
else()
|
|
|
|
find_package(MPFR)
|
|
|
|
if(MPFR_FOUND)
|
|
|
|
find_package(MPFRCppThirdparty)
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Nor Quadmath, nor MPFR found.")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endfunction()
|