File: tools.cmake

package info (click to toggle)
libappimage 0.1.9+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 3,556 kB
  • sloc: ansic: 3,262; cpp: 1,049; sh: 40; makefile: 9
file content (61 lines) | stat: -rw-r--r-- 1,803 bytes parent folder | download
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
if(TOOLS_PREFIX)
    message(STATUS "TOOLS_PREFIX set, looking for programs with prefix ${TOOLS_PREFIX}")
endif()

# first of all, make sure required programs are available
function(check_program)
    set(keywords FORCE_PREFIX)
    set(oneValueArgs NAME)
    cmake_parse_arguments(ARG "${keywords}" "${oneValueArgs}" "" "${ARGN}")

    if(NOT ARG_NAME)
        message(FATAL_ERROR "NAME argument required for check_program")
    endif()
    
    if(TOOLS_PREFIX)
        set(prefix ${TOOLS_PREFIX})
    endif()

    message(STATUS "Checking for program ${ARG_NAME}")

    string(TOUPPER ${ARG_NAME} name_upper)

    if(prefix)
        # try prefixed version first
        find_program(${name_upper} ${prefix}${ARG_NAME})
    endif()

    # try non-prefixed version
    if(NOT ${name_upper})
        if(TOOLS_PREFIX AND ARG_FORCE_PREFIX)
            message(FATAL_ERROR "TOOLS_PREFIX set, but could not find program with prefix in PATH (FORCE_PREFIX is set)")
        endif()

        find_program(${name_upper} ${ARG_NAME})

        if(NOT ${name_upper})
            message(FATAL_ERROR "Could not find required program ${ARG_NAME}.")
        endif()
    endif()

    message(STATUS "Found program ${ARG_NAME}: ${${name_upper}}")

    mark_as_advanced(${name_upper})
endfunction()

check_program(NAME aclocal)
check_program(NAME autoheader)
check_program(NAME automake)
check_program(NAME autoreconf)
check_program(NAME libtoolize)
check_program(NAME patch)
check_program(NAME sed)
#check_program(NAME wget)
check_program(NAME xxd)
check_program(NAME desktop-file-validate)
check_program(NAME objcopy FORCE_PREFIX)
check_program(NAME objdump FORCE_PREFIX)
check_program(NAME readelf FORCE_PREFIX)
check_program(NAME strip FORCE_PREFIX)
check_program(NAME make)
# TODO: add checks for remaining commands