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
+12 -11
View File
@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.16)
project(harikoff VERSION 0.00.002 LANGUAGES CXX)
include(CMakeDependentOption)
# Set C++ standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -33,23 +35,23 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR}/include
)
# Find dependencies
# Find core dependencies
find_package(Boost 1.69.0 REQUIRED COMPONENTS system)
find_package(PkgConfig REQUIRED)
# Flex/Bison setup
find_package(FLEX REQUIRED)
find_package(BISON REQUIRED)
# XCB (optional, controlled by feature flags)
option(ENABLE_XCB "Enable XCB/Xorg support" ON)
if(ENABLE_XCB)
pkg_check_modules(XCB REQUIRED xcb)
# Need dlopen() and dlsym()
find_library(DL_LIBRARY NAMES dl ldl)
if(NOT DL_LIBRARY)
message(FATAL_ERROR "Dynamic linking library (libdl/libldl) not found")
endif()
# Add subdirectories
# Add core components
add_subdirectory(hcore)
add_subdirectory(commonLibs)
add_subdirectory(senseApis)
add_subdirectory(wilzorApis)
# Main executable
add_executable(harikoff main.cpp)
@@ -58,8 +60,7 @@ target_link_libraries(harikoff
deviceManager
senseApis
${Boost_LIBRARIES}
dl
${DL_LIBRARY}
)
# Install rules
install(TARGETS harikoff DESTINATION bin)
install(TARGETS harikoff DESTINATION bin)