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.

CMakeLists.txt 975 B

12345678910111213141516171819202122232425262728293031
  1. cmake_minimum_required(VERSION 3.10)
  2. project(gpio VERSION 0.1)
  3. set(TARGET gpio)
  4. # Have CMake find pthreads library within our toolchain
  5. set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
  6. find_package(Threads REQUIRED)
  7. # Source Files
  8. set(gpio_src
  9. gpio.c readall.c
  10. )
  11. # Add library target
  12. add_executable (${TARGET} ${gpio_src})
  13. # Add include directory for gpio
  14. target_include_directories (${TARGET} PUBLIC
  15. ${CMAKE_CURRENT_SOURCE_DIR}
  16. ${CMAKE_CURRENT_SOURCE_DIR}/../wiringPiDev
  17. ${CMAKE_CURRENT_SOURCE_DIR}/../wiringPi
  18. ${CMAKE_INSTALL_PREFIX}/include)
  19. # Add the following required libraries: wiringPi, wiringPiDev, Threads, Math, Crypt, and RealTime
  20. target_link_directories(${TARGET} PUBLIC ${CMAKE_INSTALL_PREFIX}/lib)
  21. target_link_libraries(${TARGET} wiringPi wiringPiDev ${CMAKE_THREAD_LIBS_INIT} crypt m rt)
  22. # Add install
  23. install(TARGETS ${TARGET} DESTINATION bin)