target_enable_mtl4.cmake 1.16 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
macro(target_enable_mtl4 _TARGET_ _SCOPE_)
    if (${ARGC} GREATER 2)
      set(LINK_EXECUTABLE ON)
    else ()
      set(LINK_EXECUTABLE OFF)
    endif ()

    add_library(mtl4 INTERFACE)

    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)
Praetorius, Simon's avatar
Praetorius, Simon committed
15
    target_compile_definitions(${_TARGET_} ${_SCOPE_} MTL_ASSERT_FOR_THROW=1)
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

    if (ENABLE_CXX11)
      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 ()
    endif (ENABLE_CXX11)


    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)

endmacro(target_enable_mtl4)