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.
 
 
 
 
 

42 regels
1.3 KiB

  1. cmake_minimum_required(VERSION 3.0)
  2. # Must use GNUInstallDirs to install libraries into correct
  3. # locations on all platforms.
  4. include(GNUInstallDirs)
  5. # Have CMake find our pthreads library within our toolchain (required for this library)
  6. set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
  7. find_package(Threads REQUIRED)
  8. # add all the *.c files as sources
  9. FILE(GLOB SRC_FILES ${PROJECT_SOURCE_DIR}/wiringPiD/*.c
  10. ${PROJECT_SOURCE_DIR}/wiringPi/*.c
  11. )
  12. # add all the *.h files as headers
  13. FILE(GLOB HEADERS ${PROJECT_SOURCE_DIR}/devLib/*.h
  14. ${PROJECT_SOURCE_DIR}/wiringPi/*.h
  15. )
  16. # make this output a shared library (with .so output)
  17. add_library (wiringPi SHARED ${SRC_FILES})
  18. # be sure to include the current source directory for header files
  19. target_include_directories (wiringPi PUBLIC
  20. ${PROJECT_SOURCE_DIR}/wiringPi
  21. ${PROJECT_SOURCE_DIR}/devLib
  22. )
  23. # add the following required libraries:
  24. # Threads, Math, Crypt, and RealTime
  25. target_link_libraries(wiringPi ${CMAKE_THREAD_LIBS_INIT} crypt m rt)
  26. # 'make install' to the correct locations (provided by GNUInstallDirs).
  27. install(TARGETS wiringPi EXPORT rpi
  28. ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
  29. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  30. )
  31. install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})