0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-07 10:27:47 -05:00

build: Enhance Ccache performance across worktrees and build trees

To maximize performance, it is essential to follow the recommendations
in the Productivity Notes: set the `base_dir` Ccache configuration
option or use the `CCACHE_BASEDIR` environment variable.
This commit is contained in:
Hennadii Stepanov 2025-01-30 15:20:52 +00:00
parent 98939ce7b7
commit aeb3977db5
No known key found for this signature in database
GPG key ID: 410108112E7EA81F

View file

@ -2,7 +2,9 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://opensource.org/license/mit/.
if(NOT MSVC)
# The <LANG>_COMPILER_LAUNCHER target property, used to integrate
# Ccache, is supported only by the Makefiles and Ninja generators.
if(CMAKE_GENERATOR MATCHES "Make|Ninja")
find_program(CCACHE_EXECUTABLE ccache)
if(CCACHE_EXECUTABLE)
execute_process(
@ -17,8 +19,9 @@ if(NOT MSVC)
)
set(WITH_CCACHE ON)
elseif(WITH_CCACHE)
list(APPEND CMAKE_C_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE})
list(APPEND CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE})
foreach(lang IN ITEMS C CXX OBJCXX)
list(APPEND CMAKE_${lang}_COMPILER_LAUNCHER ${CMAKE_COMMAND} -E env CCACHE_NOHASHDIR=1 ${CCACHE_EXECUTABLE})
endforeach()
endif()
else()
set(WITH_CCACHE OFF)