find_mtl4.cmake 1.63 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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
find_package(MTL REQUIRED HINTS ${BASE_DIR}/lib/mtl4)
# hide options of MTL4 and use the AMDiS replacement
mark_as_advanced(ENABLE_CXX_ELEVEN)
mark_as_advanced(ENABLE_SHORT_ELE_PROD)
mark_as_advanced(ENABLE_VAMPIR)
if (MTL_FOUND)
    add_library(mtl4 INTERFACE)
    
    target_include_directories(mtl4 INTERFACE
	$<BUILD_INTERFACE:${MTL_INCLUDE_DIRS}>
	$<INSTALL_INTERFACE:include/amdis/mtl4>)
	
    if (ENABLE_CXX11)
	string (REPLACE "-std=c++0x" ""   MTL_CXX_DEFINITIONS "${MTL_CXX_DEFINITIONS}")
	string (REPLACE "-std=c++11" ""   MTL_CXX_DEFINITIONS "${MTL_CXX_DEFINITIONS}")
	string (REPLACE "-std=gnu++0x" "" MTL_CXX_DEFINITIONS "${MTL_CXX_DEFINITIONS}")
	string (REPLACE "-std=gnu++11" "" MTL_CXX_DEFINITIONS "${MTL_CXX_DEFINITIONS}")
	target_compile_features(mtl4 INTERFACE
	    cxx_rvalue_references
	    cxx_auto_type 
	    cxx_range_for 
	    cxx_generalized_initializers
	    cxx_static_assert
	    cxx_defaulted_functions)
	set(ENABLE_CXX_ELEVEN true)
    else ()
	set(ENABLE_CXX_ELEVEN false)
    endif ()
    
    if (ENABLE_UMFPACK)
	target_compile_definitions(mtl4 INTERFACE HAVE_UMFPACK=1)
    endif (ENABLE_UMFPACK)
    
    target_compile_options(mtl4 INTERFACE ${MTL_CXX_DEFINITIONS})
    target_link_libraries(mtl4 INTERFACE ${MTL_LIBRARIES})
      
    # specify how to install this target:
    # -----------------------------------
    install(DIRECTORY ${MTL_DIR}/
	    DESTINATION include/amdis/mtl4/
	    FILES_MATCHING PATTERN "*.hpp"
	    PATTERN ".svn" EXCLUDE
	    PATTERN ".svn/*" EXCLUDE
	    PATTERN "mtl4/libs" EXCLUDE
	    PATTERN "mtl4/extern" EXCLUDE)
	    
    target_link_libraries(amdis_base INTERFACE mtl4)
endif (MTL_FOUND)