setup_ccache.cmake 542 B

123456789101112131415161718
  1. #
  2. # ccache setup
  3. #
  4. list(APPEND COMPILERS
  5. "CMAKE_C_COMPILER"
  6. "CMAKE_CXX_COMPILER"
  7. )
  8. find_program(CCACHE_PROGRAM ccache)
  9. if(CCACHE_PROGRAM)
  10. foreach(compiler ${COMPILERS})
  11. get_filename_component(compiler_path "${${compiler}}" REALPATH)
  12. get_filename_component(compiler_name "${compiler_path}" NAME)
  13. if (NOT ${compiler_name} MATCHES "ccache")
  14. set("${compiler}_LAUNCHER" "${CCACHE_PROGRAM}" CACHE FILEPATH "Path to a compiler launcher program, e.g. ccache")
  15. endif()
  16. endforeach()
  17. endif()