You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

35 line
752 B

  1. # CMakeLists.txt for gpio
  2. cmake_minimum_required(VERSION 3.10)
  3. project(gpio)
  4. find_package(PkgConfig REQUIRED)
  5. pkg_check_modules(libcrypt REQUIRED IMPORTED_TARGET)
  6. find_package(Threads REQUIRED)
  7. # Source files
  8. set(SRC
  9. gpio.c
  10. readall.c
  11. )
  12. # Compiler flags
  13. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
  14. # Add the executable target
  15. add_executable(gpio ${SRC})
  16. # Find the required libraries
  17. find_library(WIRINGPI_LIB wiringPi)
  18. find_library(WIRINGPI_DEV_LIB wiringPiDev)
  19. # Link the required libraries
  20. target_link_libraries(gpio ${WIRINGPI_LIB} ${WIRINGPI_DEV_LIB} Threads::Threads m PkgConfig::libcrypt)
  21. # Install the executable
  22. install(TARGETS gpio DESTINATION bin)
  23. # Install man page
  24. install(FILES gpio.1 DESTINATION share/man/man1)