diff --git a/flang-rt/CMakeLists.txt b/flang-rt/CMakeLists.txt index 70b114041b7fd..9bc40e111c6bb 100644 --- a/flang-rt/CMakeLists.txt +++ b/flang-rt/CMakeLists.txt @@ -293,17 +293,6 @@ elseif (FLANG_RT_GCC_RESOURCE_DIR) endif () endif () -# Check if 128-bit float computations can be done via long double. -check_cxx_source_compiles( - "#include - #if LDBL_MANT_DIG != 113 - #error LDBL_MANT_DIG != 113 - #endif - int main() { return 0; } - " - HAVE_LDBL_MANT_DIG_113) - - ##################### # Build Preparation # ##################### diff --git a/flang/cmake/modules/FlangCommon.cmake b/flang/cmake/modules/FlangCommon.cmake index 1b8606843b224..bb2a76cb19453 100644 --- a/flang/cmake/modules/FlangCommon.cmake +++ b/flang/cmake/modules/FlangCommon.cmake @@ -25,8 +25,12 @@ if (FLANG_RUNTIME_F128_MATH_LIB) endif() # Check if 128-bit float computations can be done via long double -check_cxx_source_compiles( - "#include +# Note that '-nostdinc++' might be implied when this code kicks in +# (see 'runtimes/CMakeLists.txt'), so we cannot use 'cfloat' C++ header +# file in the test below. +# Compile it as C. +check_c_source_compiles( + "#include #if LDBL_MANT_DIG != 113 #error LDBL_MANT_DIG != 113 #endif