Поиск библиотек для расчётов с высокой точностью

This commit is contained in:
Andrei Astafev 2021-12-20 11:22:34 +03:00
parent ee00e43d25
commit eabd2c4b31
2 changed files with 15 additions and 12 deletions

View File

@ -1,7 +1,7 @@
# Подключение внешних проектов
include(ExternalProject)
if(MPFR_FOUND)
if(MPFR_FOUND AND IS_DIRECTORY ${CMAKE_SOURCE_DIR}/thirdparty/mpreal)
ExternalProject_Add(
mpfrcpp
SOURCE_DIR ${CMAKE_SOURCE_DIR}/thirdparty/mpreal
@ -9,7 +9,8 @@ if(MPFR_FOUND)
CONFIGURE_COMMAND true
BUILD_COMMAND true
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy <SOURCE_DIR>/mpreal.h <INSTALL_DIR>)
set(MPFRCPP_PREFIX ${CMAKE_BINARY_DIR} CACHE FILEPATH "" FORCE)
set(MPFRCPP_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "" FORCE)
endif()
set(MPFRCPP_PREFIX ${CMAKE_BINARY_DIR} CACHE FILEPATH "" FORCE)
set(MPFRCPP_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "" FORCE)

View File

@ -1,11 +1,13 @@
find_package(Quadmath)
if(QUADMATH_FOUND)
function myx_cmake_enable_high_precision_math()
find_package(Quadmath)
if(QUADMATH_FOUND)
add_definitions(-DHAVE_QUADMATH=1)
else()
else()
find_package(MPFR)
if(MPFR_FOUND)
find_package(MPFRCppThirdparty)
else()
message(FATAL_ERROR "Nor Quadmath, nor MPFR found.")
endif()
endif()
endif()
endfunction()