cmake_minimum_required(VERSION 3.20) project(PinControl) find_package(PkgConfig REQUIRED) pkg_check_modules(LIBGPIOD REQUIRED libgpiod) add_library(pin_control SHARED lib/pin_control.c lib/v4l2.c) target_include_directories(pin_control PUBLIC include/ PRIVATE ${LIBGPIOD_INCLUDE_DIRS}) target_link_libraries(pin_control PUBLIC ${LIBGPIOD_LIBRARIES}) set_target_properties(pin_control PROPERTIES POSITION_INDEPENDENT_CODE ON) target_compile_options(pin_control PUBLIC -Wall -Wextra -Werror) install(TARGETS pin_control LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(FILES include/pin_control.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})