Skip to content

Commit

Permalink
Fix compilation on FreeBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
probonopd committed Oct 3, 2020
1 parent bfa8a2a commit 1ebb66b
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ set(CMAKE_AUTOUIC ON)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")

find_package(Qt5Widgets REQUIRED)
find_package(Qt5DBus REQUIRED)
find_package(KF5WindowSystem REQUIRED)
find_package(Qt5X11Extras REQUIRED)
find_package(XCB REQUIRED COMPONENTS xcb)

set(SRCS main.cpp
menuimporter.h menuimporter.cpp
Expand Down Expand Up @@ -57,5 +60,5 @@ target_link_libraries(${PROJECT}
Qt5::DBus
Qt5::X11Extras
KF5::WindowSystem
xcb
)
${XCB_LIBRARIES}
)
53 changes: 53 additions & 0 deletions cmake/FindXCB.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#.rst:
# FindXCB
# -------
#
# Find XCB libraries
#
# Tries to find xcb libraries on unix systems.
#
# - Be sure to set the COMPONENTS to the components you want to link to
# - The XCB_LIBRARIES variable is set ONLY to your COMPONENTS list
# - To use only a specific component check the XCB_LIBRARIES_${COMPONENT} variable
#
# The following values are defined
#
# ::
#
# XCB_FOUND - True if xcb is available
# XCB_INCLUDE_DIRS - Include directories for xcb
# XCB_LIBRARIES - List of libraries for xcb
# XCB_DEFINITIONS - List of definitions for xcb
#
#=============================================================================
# Copyright (c) 2015 Jari Vetoniemi
#
# Distributed under the OSI-approved BSD License (the "License");
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================

include(FeatureSummary)
set_package_properties(XCB PROPERTIES
URL "https://xcb.freedesktop.org/"
DESCRIPTION "X protocol C-language Binding")

find_package(PkgConfig)
pkg_check_modules(PC_XCB xcb ${XCB_FIND_COMPONENTS})

find_library(XCB_LIBRARIES xcb HINTS ${PC_XCB_LIBRARY_DIRS})
find_path(XCB_INCLUDE_DIRS xcb/xcb.h PATH_SUFFIXES xcb HINTS ${PC_XCB_INCLUDE_DIRS})

foreach(COMPONENT ${XCB_FIND_COMPONENTS})
find_library(XCB_LIBRARIES_${COMPONENT} ${COMPONENT} HINTS ${PC_XCB_LIBRARY_DIRS})
list(APPEND XCB_LIBRARIES ${XCB_LIBRARIES_${COMPONENT}})
mark_as_advanced(XCB_LIBRARIES_${COMPONENT})
endforeach(COMPONENT ${XCB_FIND_COMPONENTS})

set(XCB_DEFINITIONS ${PC_XCB_CFLAGS_OTHER})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(XCB DEFAULT_MSG XCB_LIBRARIES XCB_INCLUDE_DIRS)
mark_as_advanced(XCB_INCLUDE_DIRS XCB_LIBRARIES XCB_DEFINITIONS)

0 comments on commit 1ebb66b

Please sign in to comment.