File: ccache.cmake

package info (click to toggle)
obs-source-clone 0.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 632 kB
  • sloc: ansic: 1,020; sh: 259; makefile: 23; cpp: 16
file content (25 lines) | stat: -rw-r--r-- 824 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# OBS CMake ccache module

include_guard(GLOBAL)

if(NOT DEFINED CCACHE_PROGRAM)
  message(DEBUG "Trying to find ccache on build host")
  find_program(CCACHE_PROGRAM "ccache")
  mark_as_advanced(CCACHE_PROGRAM)
endif()

if(CCACHE_PROGRAM)
  message(DEBUG "Trying to find ccache on build host - done")
  message(DEBUG "Ccache found as ${CCACHE_PROGRAM}")
  option(ENABLE_CCACHE "Enable compiler acceleration with ccache" OFF)

  if(ENABLE_CCACHE)
    set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
    set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
    set(CMAKE_OBJC_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
    set(CMAKE_OBJCXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
    set(CMAKE_CUDA_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
  endif()
else()
  message(DEBUG "Trying to find ccache on build host - skipped")
endif()