-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support more compiler launchers: distcc sccache (#3738)
Co-authored-by: Yee <[email protected]> Co-authored-by: Sophie <[email protected]>
- Loading branch information
1 parent
0992736
commit 0322542
Showing
3 changed files
with
30 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
option(ENABLE_COMPILER_LAUNCHER "Using compiler launcher if available" ON) | ||
if(NOT ENABLE_COMPILER_LAUNCHER) | ||
return() | ||
endif() | ||
|
||
set(COMPILER_LAUNCHER_OPTION | ||
"ccache" | ||
CACHE STRING "Compiler cache to be used") | ||
set(COMPILER_LAUNCHER_OPTION_VALUES "ccache" "sccache" "distcc") | ||
set_property(CACHE COMPILER_LAUNCHER_OPTION PROPERTY STRINGS ${COMPILER_LAUNCHER_OPTION_VALUES}) | ||
list( | ||
FIND | ||
COMPILER_LAUNCHER_OPTION_VALUES | ||
${COMPILER_LAUNCHER_OPTION} | ||
COMPILER_LAUNCHER_OPTION_INDEX) | ||
|
||
if(${COMPILER_LAUNCHER_OPTION_INDEX} EQUAL -1) | ||
message( | ||
STATUS | ||
"Using custom compiler launcher system: '${COMPILER_LAUNCHER_OPTION}', explicitly supported entries are ${COMPILER_LAUNCHER_OPTION_VALUES}") | ||
endif() | ||
|
||
find_program(COMPILER_LAUNCHER_BINARY ${COMPILER_LAUNCHER_OPTION}) | ||
if(COMPILER_LAUNCHER_BINARY) | ||
message(STATUS "${COMPILER_LAUNCHER_OPTION} found and enabled") | ||
set(CMAKE_CXX_COMPILER_LAUNCHER ${COMPILER_LAUNCHER_BINARY}) | ||
else() | ||
message(WARNING "${COMPILER_LAUNCHER_OPTION} is enabled but was not found. Not using it") | ||
endif() |