From 694fc0c98a832ca553f75f396ce58efd6fce2171 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Fri, 9 Aug 2013 17:44:38 +0200 Subject: [PATCH] add and use CMake modules for valgrind client requests and quadruple precision math --- cmake/Modules/FindQuadmath.cmake | 19 +++++++++++++++++++ cmake/Modules/FindValgrind.cmake | 25 +++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 cmake/Modules/FindQuadmath.cmake create mode 100644 cmake/Modules/FindValgrind.cmake diff --git a/cmake/Modules/FindQuadmath.cmake b/cmake/Modules/FindQuadmath.cmake new file mode 100644 index 000000000..63f181283 --- /dev/null +++ b/cmake/Modules/FindQuadmath.cmake @@ -0,0 +1,19 @@ +# Module that checks whether the compiler supports the +# quadruple precision floating point math +# +# Sets the following variable: +# HAVE_QUAD +# +# perform tests +include(CheckCXXSourceCompiles) +include(CMakePushCheckState) + +cmake_push_check_state() +list(APPEND CMAKE_REQUIRED_LIBRARIES "quadmath") +CHECK_C_SOURCE_COMPILES(" +#include + +int main(void){ + __float128 foo = sqrtq(123.456); +}" HAVE_QUAD) +cmake_pop_check_state() diff --git a/cmake/Modules/FindValgrind.cmake b/cmake/Modules/FindValgrind.cmake new file mode 100644 index 000000000..ae261507a --- /dev/null +++ b/cmake/Modules/FindValgrind.cmake @@ -0,0 +1,25 @@ +# Find Valgrind. +# +# This module defines: +# VALGRIND_INCLUDE_DIR, where to find valgrind/memcheck.h, etc. +# VALGRIND_PROGRAM, the valgrind executable. +# VALGRIND_FOUND, If false, do not try to use valgrind. +# +# If you have valgrind installed in a non-standard place, you can define +# VALGRIND_ROOT to tell cmake where it is. +if (VALGRIND_FOUND) + return() +endif() + +find_path(VALGRIND_INCLUDE_DIR valgrind/memcheck.h + /usr/include /usr/local/include ${VALGRIND_ROOT}/include) + +# if VALGRIND_ROOT is empty, we explicitly add /bin to the search +# path, but this does not hurt... +find_program(VALGRIND_PROGRAM NAMES valgrind PATH ${VALGRIND_ROOT}/bin) + +find_package_handle_standard_args(VALGRIND DEFAULT_MSG + VALGRIND_INCLUDE_DIR + VALGRIND_PROGRAM) + +mark_as_advanced(VALGRIND_ROOT VALGRIND_INCLUDE_DIR VALGRIND_PROGRAM)