CMake: Check for libDl, conditionally check for libXCB

This commit is contained in:
2025-07-22 04:45:23 -04:00
parent 90a0eebdd8
commit 3503cce0db
11 changed files with 82 additions and 41 deletions
+1 -4
View File
@@ -1,4 +1 @@
# Conditional compilation based on feature flags
if(ENABLE_XCB)
add_subdirectory(xcbXorg)
endif()
add_subdirectory(xcbXorg)
+17 -11
View File
@@ -1,14 +1,20 @@
add_library(xcbXorg SHARED
xcbXorg.cpp
)
option(ENABLE_LIB_xcbXorg "Enable XCB/Xorg Connection Manager backend lib" ON)
target_include_directories(xcbXorg PUBLIC
${XCB_INCLUDE_DIRS}
)
if(ENABLE_LIB_xcbXorg)
pkg_check_modules(XCB REQUIRED xcb)
if(NOT XCB_FOUND)
message(FATAL_ERROR "XCB library not found. XCB/Xorg requires the XCB dev headers and shlib.")
endif()
target_link_libraries(xcbXorg
${XCB_LIBRARIES}
)
add_library(xcbXorg SHARED
xcbXorg.cpp
)
# Install rules
install(TARGETS xcbXorg DESTINATION lib)
# Set config define for header generation
add_compile_definitions(CONFIG_LIB_XCBXORG_ENABLED)
target_include_directories(xcbXorg PUBLIC ${XCB_INCLUDE_DIRS})
target_link_libraries(xcbXorg ${XCB_LIBRARIES})
# Install rules
install(TARGETS xcbXorg DESTINATION lib)
endif()