summaryrefslogtreecommitdiff
path: root/qmake-features/add-static-library.prf
blob: 1597cf1ac0de06caf867a307f0c14d6cdef98692 (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
load(fix-library-path)

defineTest(addStaticLibrary) {
    libpath = $$1
    libext = ".a"
    libprefix = "lib"
    srcdir = $$join(libpath,,$$join(PWD,,,'/'),)
    libname = $$basename(libpath)
    libdir = $$join(libpath,,$$join(OUT_PWD,,,'/'),)

    libdir = $$fixLibraryPath($$libdir)
    win32 {
        libext = ".lib"
        libprefix = ""
    }
    libdir=$$clean_path($$libdir)

    INCLUDEPATH *= $$srcdir
    CONFIG *= link_prl

    *-gcc*:LIBS += -Wl,--whole-archive
    LIBS += $$join(libdir,,-L,)
    LIBS += $$join(libname,,-l,)
    *-gcc*:LIBS += -Wl,--no-whole-archive

    PRE_TARGETDEPS *= $$join(libdir,,,$$join(libname,,"/$$libprefix",$$libext))

    export(INCLUDEPATH)
    export(LIBS)
    export(PRE_TARGETDEPS)
    export(CONFIG)
}