bar: xcb-errors is optional

With it available, we get better (more descriptive) X error
messages. But it's not fatal, and we don't require it.
This commit is contained in:
Daniel Eklöf 2019-01-15 19:26:02 +01:00
parent b0e384b2f3
commit 7a8ba94a49
2 changed files with 22 additions and 2 deletions

View file

@ -23,7 +23,8 @@ set(CMAKE_C_FLAGS "-Wall -Werror ${CMAKE_C_FLAGS}")
find_package(Threads REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(XCB REQUIRED xcb xcb-errors xcb-randr xcb-render xcb-cursor)
pkg_check_modules(XCB REQUIRED xcb xcb-randr xcb-render xcb-cursor)
pkg_check_modules(XCB_ERRORS xcb-errors)
pkg_check_modules(FONTCONFIG REQUIRED fontconfig)
pkg_check_modules(CAIRO REQUIRED cairo cairo-xcb cairo-ft)
pkg_check_modules(YAML REQUIRED yaml-0.1)
@ -47,8 +48,13 @@ add_executable(f00bar
# Make global symbols in f00bar visible to dlopen:ed plugins
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic")
if (XCB_ERRORS_FOUND)
target_compile_definitions(f00bar PRIVATE HAVE_XCB_ERRORS)
endif ()
target_compile_options(f00bar PRIVATE
${XCB_CFLAGS_OTHER}
${XCB_ERRORS_CFLAGS_OTHER}
${FONTCONFIG_CFLAGS_OTHER}
${CAIRO_CFLAGS_OTHER}
${YAML_CFLAGS_OTHER}
@ -56,6 +62,7 @@ target_compile_options(f00bar PRIVATE
target_include_directories(f00bar PRIVATE
${XCB_INCLUDE_DIRS}
${XCB_ERRORS_INCLUDE_DIRS}
${FONTCONFIG_INCLUDE_DIRS}
${CAIRO_INCLUDE_DIRS}
${YAML_INCLUDE_DIRS}
@ -66,6 +73,7 @@ target_link_libraries(f00bar
${CMAKE_DL_LIBS}
${XCB_LIBRARIES}
${XCB_ERRORS_LIBRARIES}
${FONTCONFIG_LIBRARIES}
${CAIRO_LIBRARIES}
${YAML_LIBRARIES}