ccache.cmake 824 B

12345678910111213141516171819202122232425
  1. # OBS CMake ccache module
  2. include_guard(GLOBAL)
  3. if(NOT DEFINED CCACHE_PROGRAM)
  4. message(DEBUG "Trying to find ccache on build host")
  5. find_program(CCACHE_PROGRAM "ccache")
  6. mark_as_advanced(CCACHE_PROGRAM)
  7. endif()
  8. if(CCACHE_PROGRAM)
  9. message(DEBUG "Trying to find ccache on build host - done")
  10. message(DEBUG "Ccache found as ${CCACHE_PROGRAM}")
  11. option(ENABLE_CCACHE "Enable compiler acceleration with ccache" OFF)
  12. if(ENABLE_CCACHE)
  13. set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
  14. set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
  15. set(CMAKE_OBJC_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
  16. set(CMAKE_OBJCXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
  17. set(CMAKE_CUDA_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
  18. endif()
  19. else()
  20. message(DEBUG "Trying to find ccache on build host - skipped")
  21. endif()