From b024cfc8da083bcadf4000cc173425fbc40a864e Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Sun, 26 Oct 2025 13:20:14 +0100 Subject: [PATCH] Fix quadmath detection in CMake for Cross-Compilation --- CMakeLists.txt | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fd756c..d452567 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,22 +19,9 @@ target_include_directories(boost_charconv PUBLIC include) # find_library for quadmath does not always work so attempt # to compile the trivial test case we use with B2 -include(CheckCXXSourceRuns) -set(BOOST_CHARCONV_QUADMATH_TEST_SOURCE -" -#include -int main() -{ - __float128 f = -2.0Q; - f = fabsq(f); - __float128 big = HUGE_VALQ; - - return f == big; -} -") - +include(CheckCXXSourceCompiles) set(CMAKE_REQUIRED_LIBRARIES "quadmath") -check_cxx_source_runs("${BOOST_CHARCONV_QUADMATH_TEST_SOURCE}" BOOST_CHARCONV_QUADMATH_FOUND) +check_cxx_source_compiles("#include <${CMAKE_CURRENT_SOURCE_DIR}/config/has_float128.cpp>" BOOST_CHARCONV_QUADMATH_FOUND) set(CMAKE_REQUIRED_LIBRARIES "") target_link_libraries(boost_charconv