kdelibs/cmake/modules/FindDBusMenuQt.cmake
Ivailo Monev 3065f6f156 cmake: review CMake modules rewritten by me
since find_package_handle_standard_args() is used and no status messages
are printed by the modules there is no reason to set <MODULE>_FIND_QUIETLY
variable (which should be prefixed with the actual module name, not upper
case)

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
2020-02-19 20:52:40 +00:00

51 lines
1.6 KiB
CMake

# - Try to find DBusMenuQt library
#
# Once done this will define
#
# DBUSMENUQT_FOUND - system has DBusMenuQt
# DBUSMENUQT_INCLUDE_DIR - the DBusMenuQt include directory
# DBUSMENUQT_LIBRARIES - the libraries needed to use DBusMenuQt
# DBUSMENUQT_DEFINITIONS - compiler switches required for using DBusMenuQt
#
# Copyright (c) 2020, Ivailo Monev, <xakepa10@gmail.com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
set(DBUSMENU_QT_NAMES dbusmenu-katie dbusmenu-qt dbusmenu-qtd)
if(NOT WIN32)
find_package(PkgConfig)
foreach(name ${DBUSMENU_QT_NAMES})
if(NOT PC_DBUSMENUQT_FOUND)
pkg_check_modules(PC_DBUSMENUQT QUIET ${name})
set(DBUSMENUQT_INCLUDE_DIR ${PC_DBUSMENUQT_INCLUDE_DIRS})
set(DBUSMENUQT_LIBRARIES ${PC_DBUSMENUQT_LIBRARIES})
endif()
endforeach()
endif()
set(DBUSMENUQT_VERSION ${PC_DBUSMENUQT_VERSION})
set(DBUSMENUQT_DEFINITIONS ${PC_DBUSMENUQT_CFLAGS_OTHER})
if(NOT DBUSMENUQT_INCLUDE_DIR OR NOT DBUSMENUQT_LIBRARIES)
find_path(DBUSMENUQT_INCLUDE_DIR
NAMES dbusmenuexporter.h
PATH_SUFFIXES ${DBUSMENU_QT_NAMES}
HINTS $ENV{DBUSMENUQTDIR}/include
)
find_library(DBUSMENUQT_LIBRARIES
NAMES ${DBUSMENU_QT_NAMES}
HINTS $ENV{DBUSMENUQTDIR}/lib
)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(DBusMenuQt
VERSION_VAR DBUSMENUQT_VERSION
REQUIRED_VARS DBUSMENUQT_LIBRARIES DBUSMENUQT_INCLUDE_DIR
)
mark_as_advanced(DBUSMENUQT_INCLUDE_DIR DBUSMENUQT_LIBRARIES)