aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/blackbox/testdata/configure/modules/definition/module.qbs
blob: 6a1dbe67da207e721efc15027bc50b19d908b6b5 (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
import qbs.Process

Module {
    name: 'definition'
    Depends { name: 'cpp' }
    Probe {
        id: node
        property stringList targetOS: qbs.targetOS
        property stringList windowsShellPath: qbs.windowsShellPath
        property string result
        configure: {
            var cmd;
            var args;
            var p = path;
            if (targetOS.includes("windows")) {
                cmd = windowsShellPath;
                args = ["/c", "date", "/t"];
            } else {
                cmd = 'date';
                args = [];
            }
            var p = new Process();
            if (0 === p.exec(cmd, args)) {
                found = true;
                result = p.readLine();
            } else {
                found = false;
                result = undefined;
            }
            p.close();
        }
    }
    cpp.defines: node.found ? 'TEXT="Configured at ' + node.result + '"' : undefined
}