2021-12-08 11:32:04 +00:00
|
|
|
# Module that checks whether the compiler supports the
|
|
|
|
# quadruple precision floating point math
|
|
|
|
#
|
|
|
|
# Sets the following variables:
|
|
|
|
# QUADMATH_FOUND
|
|
|
|
# QUADMATH_LIBRARIES
|
|
|
|
#
|
|
|
|
# perform tests
|
|
|
|
include(CheckCSourceCompiles)
|
|
|
|
include(CheckCXXSourceCompiles)
|
|
|
|
include(CMakePushCheckState)
|
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
|
|
|
|
if(NOT DEFINED USE_QUADMATH OR USE_QUADMATH)
|
2021-12-09 14:13:19 +00:00
|
|
|
# if(NOT DEFINED HAVE_EXTENDED_NUMERIC_LITERALS)
|
|
|
|
# check_cxx_compiler_flag("-Werror -fext-numeric-literals" HAVE_EXTENDED_NUMERIC_LITERALS)
|
|
|
|
# endif()
|
2021-12-08 11:32:04 +00:00
|
|
|
|
2021-12-09 14:13:19 +00:00
|
|
|
# if (HAVE_EXTENDED_NUMERIC_LITERALS)
|
|
|
|
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals")
|
|
|
|
# endif()
|
2021-12-08 11:32:04 +00:00
|
|
|
|
|
|
|
cmake_push_check_state(RESET)
|
|
|
|
list(APPEND CMAKE_REQUIRED_LIBRARIES "quadmath")
|
|
|
|
CHECK_CXX_SOURCE_COMPILES("
|
|
|
|
#include <quadmath.h>
|
|
|
|
|
|
|
|
int main(void){
|
|
|
|
__float128 foo = sqrtq(123.456);
|
|
|
|
foo = FLT128_MIN;
|
|
|
|
}" QUADMATH_FOUND)
|
|
|
|
cmake_pop_check_state()
|
|
|
|
|
|
|
|
if (QUADMATH_FOUND)
|
|
|
|
set(QUADMATH_LIBRARIES "quadmath")
|
|
|
|
set(QUADMATH_FOUND "${QUADMATH_FOUND}")
|
|
|
|
set(HAVE_QUADMATH 1)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (USE_QUADMATH AND NOT QUADMATH_FOUND)
|
|
|
|
message(FATAL_ERROR "Quadruple precision math support was explicitly requested but is unavailable!")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(Quadmath
|
|
|
|
DEFAULT_MSG
|
|
|
|
QUADMATH_LIBRARIES
|
|
|
|
QUADMATH_FOUND
|
|
|
|
)
|