From eabd2c4b31c160202e3ec9e37a7d16e4f7daf250 Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Mon, 20 Dec 2021 11:22:34 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B8=D1=81=D0=BA=20=D0=B1=D0=B8?= =?UTF-8?q?=D0=B1=D0=BB=D0=B8=D0=BE=D1=82=D0=B5=D0=BA=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D1=80=D0=B0=D1=81=D1=87=D1=91=D1=82=D0=BE=D0=B2=20=D1=81=20?= =?UTF-8?q?=D0=B2=D1=8B=D1=81=D0=BE=D0=BA=D0=BE=D0=B9=20=D1=82=D0=BE=D1=87?= =?UTF-8?q?=D0=BD=D0=BE=D1=81=D1=82=D1=8C=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MyxCMake/find/FindMPFRCppThirdparty.cmake | 7 ++++--- .../functions/MyxCMakeHighPrecisionMath.cmake | 20 ++++++++++--------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/MyxCMake/find/FindMPFRCppThirdparty.cmake b/MyxCMake/find/FindMPFRCppThirdparty.cmake index 1797d17..8c7a9f1 100644 --- a/MyxCMake/find/FindMPFRCppThirdparty.cmake +++ b/MyxCMake/find/FindMPFRCppThirdparty.cmake @@ -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 /mpreal.h ) + + 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) diff --git a/MyxCMake/functions/MyxCMakeHighPrecisionMath.cmake b/MyxCMake/functions/MyxCMakeHighPrecisionMath.cmake index 0480251..9b7a0a6 100644 --- a/MyxCMake/functions/MyxCMakeHighPrecisionMath.cmake +++ b/MyxCMake/functions/MyxCMakeHighPrecisionMath.cmake @@ -1,11 +1,13 @@ -find_package(Quadmath) -if(QUADMATH_FOUND) - add_definitions(-DHAVE_QUADMATH=1) -else() - find_package(MPFR) - if(MPFR_FOUND) - find_package(MPFRCppThirdparty) +function myx_cmake_enable_high_precision_math() + find_package(Quadmath) + if(QUADMATH_FOUND) + add_definitions(-DHAVE_QUADMATH=1) else() - message(FATAL_ERROR "Nor Quadmath, nor MPFR found.") + find_package(MPFR) + if(MPFR_FOUND) + find_package(MPFRCppThirdparty) + else() + message(FATAL_ERROR "Nor Quadmath, nor MPFR found.") + endif() endif() -endif() +endfunction()