summaryrefslogtreecommitdiffstats
path: root/src/protobuf/QtProtobufProperties.cmake.in
blob: a51f0466a8dd395a238b22983d653863ce2b19c0 (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
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause

if(NOT QT_NO_CREATE_TARGETS)
    set(_@target@_proto_include_dirs "@PROTO_INCLUDE_DIRS@")
    foreach(proto_include_dir IN LISTS _@target@_proto_include_dirs)
        set_property(TARGET ${QT_CMAKE_EXPORT_NAMESPACE}::@target@ APPEND PROPERTY
            QT_PROTO_INCLUDES "${QT6_INSTALL_PREFIX}/${proto_include_dir}")
        if(CMAKE_STAGING_PREFIX)
            set_property(TARGET ${QT_CMAKE_EXPORT_NAMESPACE}::@target@ APPEND PROPERTY
                QT_PROTO_INCLUDES "${CMAKE_STAGING_PREFIX}/${proto_include_dir}")
        endif()
    endforeach()

    foreach(proto_include_dir IN LISTS _@target@_proto_external_include_dirs)
        if(NOT IS_ABSOLUTE "${proto_include_dir}")
            if(NOT QT_NO_WARN_PROTOBUF_BROKEN_INCLUDES)
                message(WRANING "The protobuf include directory ${proto_include_dir} must be an"
                    " absolute path. Skipping adding it to the @target@ module QT_PROTO_INCLUDES."
                    " Use QT_NO_WARN_PROTOBUF_BROKEN_INCLUDES to suppress this warning.")
            endif()
            continue()
        endif()
        if(NOT EXISTS "${proto_include_dir}")
            if(NOT QT_NO_WARN_PROTOBUF_BROKEN_INCLUDES)
                message(WARNING "The protobuf include directory ${proto_include_dir} doesn't exist."
                    " Skipping adding it to the @target@ module QT_PROTO_INCLUDES."
                    " Use QT_NO_WARN_PROTOBUF_BROKEN_INCLUDES to suppress this warning.")
            endif()
            continue()
        endif()

        set_property(TARGET ${QT_CMAKE_EXPORT_NAMESPACE}::@target@ APPEND PROPERTY
            QT_PROTO_INCLUDES "${proto_include_dir}")
    endforeach()

    unset(_@target@_proto_include_dirs)
endif()