ccache.cmake 691 B

12345678910111213141516171819202122
  1. # 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 "Ccache found as ${CCACHE_PROGRAM}...")
  10. option(ENABLE_CCACHE "Enable compiler acceleration with ccache" ON)
  11. if(ENABLE_CCACHE)
  12. set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
  13. set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
  14. set(CMAKE_OBJC_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
  15. set(CMAKE_OBJCXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
  16. set(CMAKE_CUDA_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
  17. endif()
  18. endif()