############################################################################
# CMakeLists.txt file for building ROOT math/vecops package
############################################################################

set(HEADERS
  ROOT/RAdoptAllocator.hxx
  ROOT/RVec.hxx
)

set(SOURCES
  RAdoptAllocator.cxx
  RVec.cxx
)

if(vdt)
  # needed for rootcling, to be removed
  include_directories(${VDT_INCLUDE_DIRS})
endif()

ROOT_STANDARD_LIBRARY_PACKAGE(ROOTVecOps
                              HEADERS ${HEADERS}
                              SOURCES ${SOURCES}
                              DICTIONARY_OPTIONS "-writeEmptyRootPCM"
                              LIBRARIES Core)

if(vdt)
  target_link_libraries(ROOTVecOps Vdt::Vdt)
endif()

target_compile_options(ROOTVecOps PRIVATE -O3 -ffast-math)

ROOT_ADD_TEST_SUBDIRECTORY(test)

############################################################################
# CMakeLists.txt file for building ROOT math/vecops package
############################################################################

set(HEADERS
  ROOT/RAdoptAllocator.hxx
  ROOT/RVec.hxx
)

set(SOURCES
  RAdoptAllocator.cxx
  RVec.cxx
)

if(vdt)
  # needed for rootcling, to be removed
  include_directories(${VDT_INCLUDE_DIRS})
endif()

ROOT_STANDARD_LIBRARY_PACKAGE(ROOTVecOps
                              HEADERS ${HEADERS}
                              SOURCES ${SOURCES}
                              DICTIONARY_OPTIONS "-writeEmptyRootPCM"
                              LIBRARIES Core)

if(vdt)
  target_link_libraries(ROOTVecOps Vdt::Vdt)
endif()

target_compile_options(ROOTVecOps PRIVATE -O3 -ffast-math)

include(CheckCXXSymbolExists)
check_symbol_exists(m __sqrt_finite HAVE_FINITE_MATH)
if(NOT HAVE_FINITE_MATH)
  target_compile_options(ROOTVecOps PRIVATE -fno-finite-math-only)
endif()

ROOT_ADD_TEST_SUBDIRECTORY(test)

Disable finite math functions for old glibc
[VecOps] Disable finite math functions for old glibc

These functions (enabled when -ffast-math is used) were only added
in glibc 2.15. However, SLC 6 still uses glibc 2.12 and clang does
not check before emitting the symbols, so linkage with clang is
broken when fast math is enabled.
