AddQuadMathFlags.cmake 801 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
# Defines the functions to use QuadMath
#
# .. cmake_function:: add_dune_quadmath_flags
#
#    .. cmake_param:: targets
#       :positional:
#       :single:
#       :required:
#
#       A list of targets to use QuadMath with.
#


function(add_dune_quadmath_flags _targets)
  if(QUADMATH_FOUND)
    foreach(_target ${_targets})
      target_link_libraries(${_target} "quadmath")
      set_property(TARGET ${_target}
        APPEND_STRING
        PROPERTY COMPILE_FLAGS "-DENABLE_QUADMATH=1 -D_GLIBCXX_USE_FLOAT128=1 ")
      if(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
        set_property(TARGET ${_target}
          APPEND_STRING
          PROPERTY COMPILE_FLAGS "-fext-numeric-literals ")
      endif()
    endforeach(_target ${_targets})
  endif(QUADMATH_FOUND)
endfunction(add_dune_quadmath_flags)