summaryrefslogtreecommitdiffstats
path: root/cmake/FindAPPINDICATOR.cmake
blob: b017d5a1aee67a64b5d0b61ba5b0a6fcd474c1af (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
53
54
55
56
57
58
59
60
61
62
63
# Remmina - The GTK+ Remote Desktop Client
#
# Copyright (C) 2011 Marc-Andre Moreau
# Copyright (C) 2014-2015 Antenore Gatta, Fabio Castelli, Giovanni Panozzo
# Copyright (C) 2016-2023 Antenore Gatta, Giovanni Panozzo
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA  02110-1301, USA.

include(FindPackageHandleStandardArgs)

# Try with ayatana-libappindicator
pkg_check_modules(PC_AYATANA_APPINDICATOR ayatana-appindicator3-0.1)

find_path(AYATANA_APPINDICATOR_INCLUDE_DIR NAMES libayatana-appindicator/app-indicator.h
    HINTS ${PC_AYATANA_APPINDICATOR_INCLUDEDIR} ${PC_AYATANA_APPINDICATOR_INCLUDE_DIRS}
    )

find_library(AYATANA_APPINDICATOR_LIBRARY NAMES ayatana-appindicator3
    HINTS ${PC_AYATANA_APPINDICATOR_LIBDIR} ${PC_AYATANA_APPINDICATOR_LIBRARY_DIRS}
    )

if(AYATANA_APPINDICATOR_INCLUDE_DIR AND AYATANA_APPINDICATOR_LIBRARY)
    find_package_handle_standard_args(APPINDICATOR DEFAULT_MSG AYATANA_APPINDICATOR_LIBRARY AYATANA_APPINDICATOR_INCLUDE_DIR)
endif()

if(APPINDICATOR_FOUND)
    add_definitions(-DHAVE_AYATANA_LIBAPPINDICATOR)
    set(APPINDICATOR_LIBRARIES ${AYATANA_APPINDICATOR_LIBRARY})
    set(APPINDICATOR_INCLUDE_DIRS ${AYATANA_APPINDICATOR_INCLUDE_DIR})
else()
    # Try with normal libappindicator
    pkg_check_modules(PC_APPINDICATOR appindicator3-0.1)

find_path(APPINDICATOR_INCLUDE_DIR NAMES libappindicator/app-indicator.h
    HINTS ${PC_APPINDICATOR_INCLUDEDIR} ${PC_APPINDICATOR_INCLUDE_DIRS}
    )

find_library(APPINDICATOR_LIBRARY NAMES appindicator3
    HINTS ${PC_APPINDICATOR_LIBDIR} ${PC_APPINDICATOR_LIBRARY_DIRS}
    )

    find_package_handle_standard_args(APPINDICATOR DEFAULT_MSG APPINDICATOR_LIBRARY APPINDICATOR_INCLUDE_DIR)

    if(APPINDICATOR_FOUND)
        set(APPINDICATOR_LIBRARIES ${APPINDICATOR_LIBRARY})
        set(APPINDICATOR_INCLUDE_DIRS ${APPINDICATOR_INCLUDE_DIR})
    endif()
endif()

mark_as_advanced(APPINDICATOR_INCLUDE_DIR APPINDICATOR_LIBRARY)