summaryrefslogtreecommitdiffstats
path: root/qmake/doc/src/snippets/qmake/replacefunction.pro
blob: 98013ba42d3ca05a9ba1e04ed83a13fd8ab3641b (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
#! [0]
defineReplace(headersAndSources) {
    variable = $$1
    names = $$eval($$variable)
    headers =
    sources =

    for(name, names) {
        header = $${name}.h
        exists($$header) {
            headers += $$header
        }
        source = $${name}.cpp
        exists($$source) {
            sources += $$source
        }
    }
    return($$headers $$sources)
}
#! [0]

defineReplace(matchingFiles) {
    names = $$ARGS
    files =

    for(name, names) {
        header = $${name}.h
        source = $${name}.cpp
        exists($$header):exists($$source) {
            files += $$header
            files += $$source
        }
    }
    return($$files)
}

names = delegate model view main
message(Finding all headers and sources from the following list of names:)
message($$names)
allFiles = $$headersAndSources(names)
message(Found: $$allFiles)

message(Finding only matching headers and sources from the following list of names:)
message($$names)
matching = $$matchingFiles($$names)
message(Found: $$matching)