Skip to content

Commit

Permalink
indi-pentax: add setcap in CMakeLists to allow "raw IO" for non-root …
Browse files Browse the repository at this point in the history
…users
  • Loading branch information
Graf2242 committed Jul 3, 2024
1 parent fce41ac commit 03ca7ca
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion indi-pentax/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.16)
cmake_minimum_required(VERSION 3.19)
PROJECT(indi_pentax CXX C)

LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/")
Expand Down Expand Up @@ -48,6 +48,21 @@ add_executable(indi_pentax ${indipentax_SRCS})

target_link_libraries(indi_pentax pthread ${PENTAX_LIBRARIES} ${INDI_LIBRARIES} ${JPEG_LIBRARIES} ${LibRaw_LIBRARIES} ${CFITSIO_LIBRARIES} ${ZLIB_LIBRARY})

find_program(SUDO sudo)
if(NOT SUDO)
message(WARNING "sudo must be available on the system in order to set permissions for the driver")
else()
message("-- sudo command: ${SUDO}")
endif()

find_program(SETCAP setcap)
if(NOT SETCAP)
message(WARNING "setcap not found, driver may not work because of lack of permissions")
else()
message("-- setcap command: ${SETCAP}")
install(CODE "execute_process(COMMAND ${SUDO} -S ${SETCAP} cap_sys_rawio+ep indi_pentax)")
endif()

install(TARGETS indi_pentax RUNTIME DESTINATION bin)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/indi_pentax.xml DESTINATION ${INDI_DATA_DIR})

0 comments on commit 03ca7ca

Please sign in to comment.