target_enable_mtl4.cmake 1.06 KB
Newer Older
1
macro(target_enable_mtl4 _TARGET_ _SCOPE_)
2 3 4 5 6
  if (${ARGC} GREATER 2)
    set(LINK_EXECUTABLE ON)
  else ()
    set(LINK_EXECUTABLE OFF)
  endif ()
7

8
  add_library(mtl4 INTERFACE)
9

10 11 12 13 14 15
  if (LINK_EXECUTABLE)
    target_include_directories(${_TARGET_} ${_SCOPE_} ${AMDIS_INCLUDE_DIR}/mtl4)
  else ()
    target_include_directories(${_TARGET_} ${_SCOPE_} ${BASE_DIR}/lib/mtl4)
  endif (LINK_EXECUTABLE)
  target_compile_definitions(${_TARGET_} ${_SCOPE_} MTL_ASSERT_FOR_THROW=1)
16

17 18 19 20
  set (CXX_ELEVEN_FEATURE_LIST "MOVE" "AUTO" "RANGEDFOR" "INITLIST" "STATICASSERT" "DEFAULTIMPL")
  foreach (feature ${CXX_ELEVEN_FEATURE_LIST})
    target_compile_definitions(${_TARGET_} ${_SCOPE_} MTL_WITH_${feature})
  endforeach ()
21 22


23 24 25 26 27 28 29 30 31
  if (ENABLE_OPENMP)
      find_package(OpenMP REQUIRED)
      if (OPENMP_FOUND)
        target_compile_definitions(${_TARGET_} ${_SCOPE_} MTL_WITH_OPENMP)
        target_compile_options(${_TARGET_} ${_SCOPE_} ${OpenMP_CXX_FLAGS})
      else ()
        message(FATAL_ERROR "OpenMP not found")
      endif (OPENMP_FOUND)
  endif (ENABLE_OPENMP)
32
endmacro(target_enable_mtl4)