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) else() find_package(MPFR) if(MPFR_FOUND) find_package(MPFRCppThirdparty) else() message(FATAL_ERROR "Nor Quadmath, nor MPFR found.") endif() endif() endfunction()