1
1
# SPDX-FileCopyrightText: 2021 Tenacity Audio Editor contributors
2
2
# SPDX-FileContributor: Be <[email protected] >
3
3
# SPDX-FileContributor: Emily Mabrey <[email protected] >
4
+ # SPDX-FileContributor: Leon Matthes <[email protected] >
4
5
#
5
6
# SPDX-License-Identifier: BSD-3-Clause
6
7
#[=======================================================================[.rst:
7
8
CompilerCaching
8
9
---------------
9
10
10
11
Search for sccache and ccache and use them for compiler caching for C & C++.
11
- ccache is preferred if both are found, but the user can override this by
12
- explicitly setting CCACHE =OFF to use sccache when both are installed.
12
+ sccache is preferred if both are found, but the user can override this by
13
+ explicitly setting SCCACHE =OFF to use ccache when both are installed.
13
14
#]=======================================================================]
14
15
15
16
# ccache does not support MSVC
@@ -33,14 +34,14 @@ else()
33
34
option (SCCACHE "Use sccache for compiler caching to speed up rebuilds." ON )
34
35
endif ()
35
36
36
- if (CCACHE)
37
- message (STATUS "Using ccache for compiler caching to speed up rebuilds" )
38
- set (CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM} " )
39
- set (CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM} " )
40
- elseif (SCCACHE)
37
+ if (SCCACHE)
41
38
message (STATUS "Using sccache for compiler caching to speed up rebuilds" )
42
39
set (CMAKE_C_COMPILER_LAUNCHER "${SCCACHE_PROGRAM} " )
43
40
set (CMAKE_CXX_COMPILER_LAUNCHER "${SCCACHE_PROGRAM} " )
41
+ if (NOT DEFINED ENV{RUSTC_WRAPPER})
42
+ # Enable sccache for rustc - especially important when building cxx-qt-lib!
43
+ set (CMAKE_RUSTC_WRAPPER "${SCCACHE_PROGRAM} " CACHE PATH "RUSTC_WRAPPER detected by CMake" )
44
+ endif ()
44
45
45
46
# Instruct MSVC to generate symbolic debug information within object files for sccache
46
47
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
@@ -56,6 +57,10 @@ elseif(SCCACHE)
56
57
string (REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_${CONFIG} "${CMAKE_C_FLAGS_${CONFIG} }" )
57
58
endif ()
58
59
endif ()
60
+ elseif (CCACHE)
61
+ message (STATUS "Using ccache for compiler caching to speed up rebuilds" )
62
+ set (CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM} " )
63
+ set (CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM} " )
59
64
else ()
60
65
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
61
66
message (STATUS "No compiler caching enabled. Install sccache to speed up rebuilds." )
0 commit comments