summaryrefslogtreecommitdiffstats
path: root/cmake/QtPostProcess.cmake
blob: 5e563d4c915cda35f983a7207233c8ca332eb8de (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
function(qt_internal_write_depends_file target)
    set(module Qt${target})
    set(outfile "${PROJECT_BINARY_DIR}/include/${module}/${module}Depends")
    message("Generate ${outfile}...")
    set(contents "/* This file was generated by cmake with the info from ${module} target. */\n")
    string(APPEND contents "#ifdef __cplusplus /* create empty PCH in C mode */\n")
    foreach (m ${ARGN})
        string(APPEND contents "#  include <Qt${m}/Qt${m}>\n")
    endforeach()
    string(APPEND contents "#endif\n")

    file(GENERATE OUTPUT ${outfile} CONTENT ${contents})
endfunction()

function(qt_internal_create_depends_files)
    message("Generating depends files for ${KNOWN_QT_MODULES}...")
    foreach (target ${KNOWN_QT_MODULES})
        get_target_property(depends "${target}" LINK_LIBRARIES)
        foreach (dep ${depends})
            list(FIND KNOWN_QT_MODULES "${dep}" _pos)
            if (_pos GREATER -1)
                list(APPEND qtdeps "${dep}")
            endif()
        endforeach()
        get_target_property(hasModuleHeaders "${target}" MODULE_HAS_HEADERS)
        if (${hasModuleHeaders})
            qt_internal_write_depends_file("${target}" ${qtdeps})
        endif()
    endforeach()
endfunction()

qt_internal_create_depends_files()