1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-16 12:10:31 +00:00
conky/cmake/CCache.cmake
Tin Švagelj 5ee7bd1185
Add compiler cache and fix CMake deprecation warnings (#2132)
- Fix use of deprecated `exec_program`.
- Reformat 'UninstallConky.cmake.in' file.
- Separate BUILD_TESTS (now BUILD_TESTING to shadow CTest variable) from
  MAINTAINER_MODE flag.
  - Remove BUILD_TESTS flag from CI, default it already true.
- Add support for (s)ccache, enable it by default.
- Add REPRODUCIBLE_BUILD to disable (s)ccache default.
  - Set REPRODUCIBLE_BUILD=ON in nix flake.
- Add sccache to CI.
- Add CI detection for possible future use, stored in ENV_IS_CI variable.
- Minor formatting tweaks.

Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
2025-01-05 05:37:03 +00:00

23 lines
653 B
CMake

if(NOT USE_CCACHE)
return()
endif()
find_program(CCACHE_COMMAND sccache)
if(CCACHE_COMMAND)
mark_as_advanced(CCACHE_COMMAND)
message(STATUS "Using sccache; disable with '-DUSE_CCACHE=OFF'")
else()
find_program(CCACHE_COMMAND ccache)
if(CCACHE_COMMAND)
mark_as_advanced(CCACHE_COMMAND)
message(STATUS "Using ccache; disable with '-DUSE_CCACHE=OFF'")
else()
message(WARNING "Neither sccache nor ccache found")
return()
endif()
endif()
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_COMMAND}")
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_COMMAND}")
set(CMAKE_CUDA_COMPILER_LAUNCHER "${CCACHE_COMMAND}")