summaryrefslogtreecommitdiffstats
path: root/cmake/QtConfigDependencies.cmake.in
blob: 159d3c020c7d4850464b4901ca6ccbb074552276 (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
47
48
49
50
51
52
set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND FALSE)

# note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;"
set(_third_party_deps "@third_party_deps@")

@third_party_extra@

foreach(_target_dep ${_third_party_deps})
    list(GET _target_dep 0 pkg)
    list(GET _target_dep 1 is_optional)
    list(GET _target_dep 2 version)
    list(GET _target_dep 3 components)
    list(GET _target_dep 4 optional_components)
    set(find_package_args "${pkg}")
    if(version)
        list(APPEND find_package_args "${version}")
    endif()
    if(components)
        string(REPLACE " " ";" components "${components}")
        list(APPEND find_package_args COMPONENTS ${components})
    endif()
    if(optional_components)
        string(REPLACE " " ";" optional_components "${optional_components}")
        list(APPEND find_package_args OPTIONAL_COMPONENTS ${optional_components})
    endif()

    # Already build an error message, because find_dependency calls return() on failure.
    set(__@INSTALL_CMAKE_NAMESPACE@_message "\nPackage: ${pkg}")
    if(version)
        string(APPEND __@INSTALL_CMAKE_NAMESPACE@_message "\nVersion: ${version}")
    endif()
    if(components)
        string(APPEND __@INSTALL_CMAKE_NAMESPACE@_message "\nComponents: ${components}")
    endif()
    if(optional_components)
        string(APPEND __@INSTALL_CMAKE_NAMESPACE@_message "\nComponents: ${optional_components}")
    endif()
    set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE
        "${__@INSTALL_CMAKE_NAMESPACE@_message}")

    if(is_optional)
        if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
            list(APPEND find_package_args QUIET)
        endif()
        find_package(${find_package_args})
    else()
        find_dependency(${find_package_args})
    endif()
endforeach()

set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND TRUE)
unset(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE)