forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ccache.cmake
28 lines (26 loc) · 960 Bytes
/
ccache.cmake
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
26
27
28
# Copyright (c) 2023-present The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://opensource.org/license/mit/.
if(NOT MSVC)
find_program(CCACHE_EXECUTABLE ccache)
if(CCACHE_EXECUTABLE)
execute_process(
COMMAND readlink -f ${CMAKE_CXX_COMPILER}
OUTPUT_VARIABLE compiler_resolved_link
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(CCACHE_EXECUTABLE STREQUAL compiler_resolved_link AND NOT WITH_CCACHE)
list(APPEND configure_warnings
"Disabling ccache was attempted using -DWITH_CCACHE=${WITH_CCACHE}, but ccache masquerades as the compiler."
)
set(WITH_CCACHE ON)
elseif(WITH_CCACHE)
list(APPEND CMAKE_C_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE})
list(APPEND CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_EXECUTABLE})
endif()
else()
set(WITH_CCACHE OFF)
endif()
endif()
mark_as_advanced(CCACHE_EXECUTABLE)