Функция для подключения вычислений с высокой точностью

This commit is contained in:
Andrei Astafev 2021-07-06 04:40:23 +03:00
parent 7cb811e4d1
commit 7c22ac6b82
2 changed files with 41 additions and 0 deletions

View File

@ -30,6 +30,7 @@ include(CMLibLSBInfo)
include(CMLibCompiler) include(CMLibCompiler)
include(CMLibCompilerFlags) include(CMLibCompilerFlags)
include(CMLibDistCC) include(CMLibDistCC)
include(CMLibHighPrecisionMath)
include(CMLibGenerateCompilerFeaturesHPP) include(CMLibGenerateCompilerFeaturesHPP)
include(CMLibFlagRemove) include(CMLibFlagRemove)
include(CMLibCotire) include(CMLibCotire)

View File

@ -0,0 +1,40 @@
function(enable_high_precision_math)
set(options QUAD MPFR)
set(oneValueArgs)
set(multiValueArgs)
cmake_parse_arguments(_PKG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(MPFR AND QUAD)
message(FATAL_ERROR "Mutually exclusive options QUAD and MPFR")
endif()
if(MPFR)
find_package(MPFR)
if(MPFR_FOUND)
find_package(MPFRCppThirdparty)
endif()
return()
endif()
if(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)
else()
find_package(MPFR)
if(MPFR_FOUND)
find_package(MPFRCppThirdparty)
else()
message(FATAL_ERROR "Nor Quadmath, nor MPFR found.")
endif()
endif()
endfunction()