CMakeLists.txt 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Determine the current vendor, export to CURRENT_VENDOR
  2. if (NOT DEFINED CURRENT_VENDOR)
  3. execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/getinfo current
  4. OUTPUT_VARIABLE CURRENT_VENDOR_OUT OUTPUT_STRIP_TRAILING_WHITESPACE)
  5. set(CURRENT_VENDOR "${CURRENT_VENDOR_OUT}" CACHE STRING "Select the system vendor")
  6. message(STATUS "Detected vendor: ${CURRENT_VENDOR_OUT}")
  7. else()
  8. message(STATUS "Detected vendor: ${CURRENT_VENDOR} (cached)")
  9. endif()
  10. # Handle sources.list example
  11. add_vendor_file(OUTPUT sources.list
  12. INPUT "${CURRENT_VENDOR}/sources.list.in"
  13. MODE 644
  14. VARIABLES sourceslist-list-format
  15. debian-stable-codename
  16. debian-oldstable-codename
  17. debian-testing-codename
  18. ubuntu-codename
  19. current-codename)
  20. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/sources.list
  21. DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples)
  22. # Handle apt.conf snippets
  23. file(GLOB conffiles ${CURRENT_VENDOR}/apt.conf-*)
  24. foreach(file ${conffiles})
  25. file(RELATIVE_PATH confname ${CMAKE_CURRENT_SOURCE_DIR}/${CURRENT_VENDOR}/ ${file})
  26. string(REPLACE "apt.conf-" "" confname "${confname}")
  27. install(FILES "${file}"
  28. DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/apt/apt.conf.d/"
  29. RENAME "${confname}")
  30. endforeach()
  31. if (EXISTS "${CURRENT_VENDOR}/CMakeLists.txt")
  32. add_subdirectory(${CURRENT_VENDOR})
  33. endif()