File: FindTPLLIBQUADMATH.cmake

package info (click to toggle)
kokkos 5.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 15,148 kB
  • sloc: cpp: 225,388; sh: 1,250; python: 78; makefile: 16; fortran: 4; ansic: 2
file content (22 lines) | stat: -rw-r--r-- 734 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# gcc bundles libquadmath and doesn't need any extra link or include directories
# (which would not be contained in CMake's search paths anyway).
# Hence, try if the compiler supports libquadmath natively first before doing
# the standard package search.
set(CMAKE_REQUIRED_LIBRARIES "quadmath")
include(CheckCXXSourceCompiles)
check_cxx_source_compiles(
  "
  #include <quadmath.h>
  int main(void){
      __float128 foo = ::sqrtq(123.456);
      return foo;
  }"
  KOKKOS_QUADMATH_COMPILER_SUPPORT
)
unset(CMAKE_REQUIRED_LIBRARIES)

if(KOKKOS_QUADMATH_COMPILER_SUPPORT)
  kokkos_create_imported_tpl(LIBQUADMATH INTERFACE LINK_LIBRARIES quadmath)
else()
  kokkos_find_imported(LIBQUADMATH HEADER quadmath.h LIBRARY quadmath)
endif()