opm-simulators/cmake/Modules/FindQuadmath.cmake
Andreas Lauser a2d4a32736 make the build system link to the "quadmath" library if it is supported
Thanks a lot to Roland Kaufmann for the support.
2013-08-16 23:55:31 +02:00

32 lines
653 B
CMake

# Module that checks whether the compiler supports the
# quadruple precision floating point math
#
# Sets the following variables:
# HAVE_QUAD
# QUADMATH_LIBRARIES
#
# perform tests
include(CheckCXXSourceCompiles)
include(CMakePushCheckState)
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_LIBRARIES "quadmath")
CHECK_C_SOURCE_COMPILES("
#include <quadmath.h>
int main(void){
__float128 foo = sqrtq(123.456);
}" HAVE_QUAD)
cmake_pop_check_state()
if (HAVE_QUAD)
set(QUADMATH_LIBRARIES "quadmath")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(QuadMath
DEFAULT_MSG
QUADMATH_LIBRARIES
HAVE_QUAD
)