File: leatherman_config.cmake

package info (click to toggle)
leatherman 1.4.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,944 kB
  • sloc: cpp: 14,555; python: 3,105; sh: 45; makefile: 9; ruby: 1
file content (80 lines) | stat: -rw-r--r-- 2,490 bytes parent folder | download | duplicates (3)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
include(leatherman)

# Usage: add_leatherman_deps(${DEP1_LIB} ${DEP2_LIB})
#
# Append to the LEATHERMAN_<LIBRARY>_DEPS variable.
macro(add_leatherman_deps)
    list(APPEND ${deps_var} ${ARGV})
endmacro()

# Usage: add_leatherman_includes(${DIR1} ${DIR2})
#
# Append to the LEATHERMAN_<LIBRARY>_INCLUDE variable
macro(add_leatherman_includes)
    list(APPEND ${include_var} ${ARGV})
    list(REMOVE_DUPLICATES ${include_var})
endmacro()

# Usage: leatherman_dependency("libname")
#
# Automatically handle include directories and library linking for the
# given leatherman library.
#
# Will throw a fatal error if the dependency cannot be found.
macro(leatherman_dependency library)
    string(MAKE_C_IDENTIFIER "${library}" lib)
    string(TOUPPER "${lib}" name)
    set(option "LEATHERMAN_USE_${name}")
    set(dep_lib "LEATHERMAN_${name}_LIB")
    set(dep_deps "LEATHERMAN_${name}_DEPS")
    set(dep_include "LEATHERMAN_${name}_INCLUDE")

    if (NOT "" STREQUAL "${${dep_deps}}")
        debug("Adding ${${dep_deps}} to deps for ${id_upper}")
        list(APPEND ${deps_var} ${${dep_deps}})
    endif()
    if (NOT "" STREQUAL "${${dep_lib}}")
        debug("Adding ${${dep_lib}} to deps for ${id_upper}")
        list(APPEND ${deps_var} ${${dep_lib}})
    endif()
    if (NOT "" STREQUAL "${${dep_include}}")
        debug("Adding ${${dep_include}} to include directories for ${id_upper}")
        list(APPEND ${include_var} ${${dep_include}})
        list(REMOVE_DUPLICATES ${include_var})
    endif()
endmacro()

macro(add_leatherman_library)
    set(${lib_var} "${libname}")
endmacro()

macro(add_leatherman_headers)
endmacro()

macro(add_leatherman_test)
endmacro()

macro(add_leatherman_vendored pkg md5 header_path)
    add_leatherman_includes("${LEATHERMAN_PREFIX}/include/leatherman/vendor")
endmacro()

macro(leatherman_component id)
    string(TOUPPER "${id}" id_upper)
    set(include_var "LEATHERMAN_${id_upper}_INCLUDE")
    set(lib_var "LEATHERMAN_${id_upper}_LIB")
    set(deps_var "LEATHERMAN_${id_upper}_DEPS")
    set(include_dir "${LEATHERMAN_PREFIX}/include")
    set(libname "leatherman_${id}")
    set(${include_var} ${include_dir})
    set(${lib_var} "")

    include("${current_directory}/${id}.cmake")

    set(libs_var "LEATHERMAN_${id_upper}_LIBS")
    set(${libs_var} ${${lib_var}} ${${deps_var}})

    if("${ARGV1}" STREQUAL EXCLUDE_FROM_VARS)
        set(exclude_var "LEATHERMAN_EXCLUDE_${id_upper}")
        set(${exclude_var} TRUE)
    endif()
endmacro()