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.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. cmake_minimum_required(VERSION 3.10)
  2. project(wiringPi VERSION 0.1)
  3. set(TARGET wiringPi)
  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(wiringPi_src
  9. ads1115.c bmp180.c drcNet.c drcSerial.c
  10. ds18b20.c htu21d.c max31855.c max5322.c
  11. mcp23008.c mcp23016.c mcp23017.c mcp23s08.c
  12. mcp23s17.c mcp3002.c mcp3004.c mcp3422.c
  13. mcp4802.c pcf8574.c pcf8591.c piHiPri.c
  14. piThread.c pseudoPins.c rht03.c sn3218.c
  15. softPwm.c softServo.c softTone.c sr595.c
  16. wiringPi.c wiringPiI2C.c wiringPiSPI.c
  17. wiringSerial.c wiringShift.c wpiExtensions.c
  18. )
  19. # Headers file
  20. set(wiringPi_h
  21. ads1115.h bmp180.h drcNet.h drcSerial.h
  22. ds18b20.h htu21d.h max31855.h max5322.h
  23. mcp23008.h mcp23016.h mcp23016reg.h mcp23017.h
  24. mcp23s08.h mcp23s17.h mcp23x08.h mcp23x0817.h
  25. mcp3002.h mcp3004.h mcp3422.h mcp4802.h
  26. pcf8574.h pcf8591.h pseudoPins.h rht03.h
  27. sn3218.h softPwm.h softServo.h softTone.h
  28. sr595.h wiringPi.h wiringPiI2C.h wiringPiSPI.h
  29. wiringSerial.h wiringShift.h wpiExtensions.h
  30. )
  31. # Add library target
  32. add_library (${TARGET} SHARED ${wiringPi_src})
  33. # Add include directory for wiringPi
  34. target_include_directories (${TARGET} PUBLIC
  35. ${CMAKE_CURRENT_SOURCE_DIR}
  36. ${CMAKE_INSTALL_PREFIX}/include)
  37. # Add the following required libraries: Threads, Math, Crypt, and RealTime
  38. target_link_libraries(${TARGET} ${CMAKE_THREAD_LIBS_INIT} crypt m rt)
  39. # Expose wiringPi public to other subprojects
  40. set(${TARGET}_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
  41. CACHE INTERNAL "${PROJECT_NAME}: Include directories" FORCE
  42. )
  43. # Add install
  44. install(TARGETS ${TARGET} DESTINATION lib)
  45. install(FILES ${wiringPi_h} DESTINATION include)