aboutsummaryrefslogtreecommitdiff
path: root/toolchain/specifydependencies.cmake
blob: e01c61a7177c5868f26cb6233d9cb44fc757b6e3 (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
file(READ "${TARGET_DIR}/CMakeFiles/${TARGET_NAME}.dir/link.txt" out)

string(FIND "${out}" "-o ${TARGET_NAME}" POS) #we trim the initial arguments, we want the ones in the end. we find the target
string(SUBSTRING "${out}" ${POS} -1 out) #we
string(REGEX MATCHALL " /.+\\.so" outout "${out}")
string(STRIP "${outout}" outout)
string(REPLACE " /" ";/" outout "${outout}")

set(extralibs)
foreach(lib IN LISTS outout) #now we filter Qt5 libraries, because Qt wants to take care about these itself
    if(NOT ${lib} MATCHES ".*/libQt5.*")
        if(extralibs)
            set(extralibs "${extralibs},${lib}")
        else()
            set(extralibs "${lib}")
        endif()
    endif()
endforeach()
if(extralibs)
    set(extralibs "\"android-extra-libs\": \"${extralibs}\",")
endif()

set(extraplugins)
foreach(folder "share" "lib/qml") #now we check for folders with extra stuff
    set(plugin "${EXPORT_DIR}/${folder}")
    if(EXISTS "${plugin}")
        if(extraplugins)
            set(extraplugins "${extraplugins},${plugin}")
        else()
            set(extraplugins "${plugin}")
        endif()
    endif()
endforeach()
if(extraplugins)
    set(extraplugins "\"android-extra-plugins\": \"${extraplugins}\",")
endif()

file(READ "${INPUT_FILE}" CONTENTS)
string(REPLACE "##EXTRALIBS##" "${extralibs}" NEWCONTENTS "${CONTENTS}")
string(REPLACE "##EXTRAPLUGINS##" "${extraplugins}" NEWCONTENTS "${NEWCONTENTS}")
file(WRITE "${OUTPUT_FILE}" ${NEWCONTENTS})