summaryrefslogtreecommitdiffstats
path: root/mkspecs/features/cmake_functions.prf
blob: 1e6b05c78e9b51625644c7824eb9e70e177527f0 (plain)
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
#
#  W A R N I N G
#  -------------
#
# This file is not part of the Qt API.  It exists purely as an
# implementation detail.  It may change from version to version
# without notice, or even be removed.
#
# We mean it.
#

defineReplace(cmakeModuleName) {
    _module = $$1
    _name = $$eval(QT.$${_module}.name)
    cmake_module_name = $$replace(_name, ^Qt, )
    return ($$cmake_module_name)
}

defineReplace(cmakeModuleList) {
    variable = $$1
    out =
    for(v, variable) {
        out += $$cmakeModuleName($$v)
    }
    return ($$join(out, ";"))
}

defineReplace(cmakeTargetPath) {
    SYSR = $$[QT_SYSROOT]
    !isEmpty(SYSR): path = /$$relative_path($$1, $$[QT_SYSROOT])
    else: path = $$1
    return($$clean_path($$path))
}

defineReplace(cmakeTargetPaths) {
    variable = $$1
    out =
    for(v, variable) {
        out += \"$$cmakeTargetPath($$v)\"
    }
    return ($$join(out, " "))
}

defineReplace(cmakePortablePaths) {
    variable = $$1
    out =
    for(v, variable) {
        out += $$[QT_SYSROOT]$$cmakeTargetPath($$v)
    }
    return ($$join(out, ";"))
}

defineReplace(cmakeProcessLibs) {
    variable = $$1
    out =
    for(v, variable) {
        if(!equals(v, -framework):!contains(v, -L.*)) {
            v ~= s,^-l,,
            v ~= s,^-lib,,
            v ~= s,.lib$,,
            out += $$v
        }
    }
    return ($$join(out, ";"))
}

defineReplace(cmakeRelativePath) {
    path = $$relative_path($$1, $$2)
    return($$replace(path, ([^/])$, \\1/))
}