kdelibs/cmake/modules/FindDBusMenuQt.cmake
Ivailo Monev 3eb17fdf2b cmake: review modules rewritten so far by me
using pkg-config search as primary method with fallback to path lookup,
this may result in overlinking however if libraries require additional
include paths (as is the case with PulseAudio) with this change that will
not be a problem.

it will also reduce the lookups done during configuration/build since path
lookups will not be done, unless pkg-config lookup does not set the
required variables.

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

50 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_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 PC_DBUSMENUQT_VERSION
REQUIRED_VARS DBUSMENUQT_LIBRARIES DBUSMENUQT_INCLUDE_DIR
)
mark_as_advanced(DBUSMENUQT_INCLUDE_DIR DBUSMENUQT_LIBRARIES)