Skip to content

Conversation

@mborland
Copy link
Member

Fixes: #191

The next step in the never ending battle to get this correct. @pdimov Do you see any potential issues with this? I replaced check_cxx_source_compiles with check_cxx_source_runs due to Reuben's previous issue (#176) where the header existed, but the compiled library did not.

@codecov
Copy link

codecov bot commented Apr 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.01%. Comparing base (007ac06) to head (f2d2aca).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #193   +/-   ##
========================================
  Coverage    94.01%   94.01%           
========================================
  Files           66       66           
  Lines         8439     8439           
========================================
  Hits          7934     7934           
  Misses         505      505           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 007ac06...f2d2aca. Read the comment docs.

@pdimov
Copy link
Member

pdimov commented Apr 23, 2024

This looks OK to me, by visual inspection alone.

@mborland
Copy link
Member Author

Looking at the old CI runs the posix-cmake-test suite all yielded -- Boost.Charconv: quadmath support OFF. Now the macOS runs show -- Boost.Charconv: quadmath support OFF as they should, and Ubuntu runs show -- Boost.Charconv: quadmath support ON.

@mborland mborland merged commit 11f03b7 into develop Apr 23, 2024
@mborland mborland deleted the CML branch April 23, 2024 10:10
@erikbs
Copy link

erikbs commented Oct 23, 2025

@mborland This change breaks cross-compilation (CMake Error: try_run() invoked in cross-compiling mode ). I grep-ed the Boost source archive after check_cxx_source_ and this seems to be the only place where _runs is used instead of _compiles. Following the pattern elsewhere I did this:

@@ -9,0 +10,2 @@ project(boost_charconv VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
+include(CheckCXXSourceCompiles)
+
@@ -22,14 +23,0 @@ target_include_directories(boost_charconv PUBLIC include)
-include(CheckCXXSourceRuns)
-set(BOOST_CHARCONV_QUADMATH_TEST_SOURCE
-"
-#include <quadmath.h>
-int main()
-{
-    __float128 f = -2.0Q;
-    f = fabsq(f);
-    __float128 big = HUGE_VALQ;
-
-    return f == big;
-}
-")
-
@@ -37 +25 @@ 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)

which seems to fix the problem for me (revert to cxx_check_source_compiles, but keep CMAKE_REQUIRED_LIBRARIES and set the source to including has_float128.cpp, because the original check had an incorrect source file containing nothing but that file path). From what I understand, _compiles is insufficient on Alpine because the header is present while the library is not? But wouldn't set(CMAKE_REQUIRED_LIBRARIES "quadmath") catch that case? I don't have an Alpine installation to test on, but I tested a minimal CMake example that has a check_cxx_source_compiles, then set CMAKE_REQUIRED_LIBRARIES to "does_not_exist" and it failed as expected.

@mborland
Copy link
Member Author

@erikbs your patch has been merged in #284. It was confirmed fine on the referenced Alpine Linux environment.

@erikbs
Copy link

erikbs commented Oct 29, 2025

Great! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cmake: Incorrect __float128 detection

4 participants