FindMTL.cmake 1.33 KB
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
# FindMTL.cmake
#
# Finds the MTL4 library
#
# This will define the following variables
#
#    MTL_FOUND
#    MTL_INCLUDE_DIR
#    MTL_COMPILE_DEFINITIONS
#
# and the following imported targets
#
#     MTL::MTL
#
# Author: Simon Praetorius <simon.praetorius@tu-dresden.de>


mark_as_advanced(MTL_FOUND MTL_COMPILE_DEFINITIONS MTL_INCLUDE_DIR)

find_path(MTL_INCLUDE_DIR boost/numeric/mtl/mtl.hpp
  HINTS
    ${CMAKE_CURRENT_SOURCE_DIR}/../../libs/mtl4
    ${CMAKE_CURRENT_SOURCE_DIR}/../../include/mtl4
24
    ${MTL_DIR}/../../include
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
    ENV EBROOTMTL
  PATHS
    /opt/software/mtl
    /opt/sources/mtl
    /opt/development/mtl
)

set(MTL_COMPILE_DEFINITIONS MTL_ASSERT_FOR_THROW=1)
foreach(feature "MOVE" "AUTO" "RANGEDFOR" "INITLIST" "STATICASSERT" "DEFAULTIMPL")
  list(APPEND MTL_COMPILE_DEFINITIONS MTL_WITH_${feature})
endforeach(feature)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MTL
  REQUIRED_VARS MTL_INCLUDE_DIR
)

if(MTL_FOUND AND NOT TARGET MTL::MTL)
  add_library(MTL::MTL INTERFACE IMPORTED)

  find_package(SuiteSparse QUIET)
  if (SuiteSparse_FOUND)
    list(APPEND MTL_COMPILE_DEFINITIONS "MTL_HAS_UMFPACK")
  endif (SuiteSparse_FOUND)

  set_target_properties(MTL::MTL PROPERTIES
    INTERFACE_INCLUDE_DIRECTORIES "${MTL_INCLUDE_DIR}"
    INTERFACE_COMPILE_DEFINITIONS "${MTL_COMPILE_DEFINITIONS}"
  )
endif()