-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
28 additions
and
12 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 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 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,25 @@ | ||
option(USE_COMPILE_CACHE "Use ccache or clcache for compilation" OFF) | ||
|
||
# Compatibility for old option name | ||
if(USE_CCACHE) | ||
set(USE_COMPILE_CACHE ON) | ||
endif() | ||
|
||
if(USE_COMPILE_CACHE) | ||
if(MSVC) | ||
set(CACHE_TOOL_NAME clcache) | ||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|AppleClang|Clang)") | ||
set(CACHE_TOOL_NAME ccache) | ||
else() | ||
message(WARNING "Compile cache only available with MSVC or GNU") | ||
endif() | ||
|
||
find_program(CACHE_TOOL ${CACHE_TOOL_NAME}) | ||
if (CACHE_TOOL) | ||
message(STATUS "Using ${CACHE_TOOL} found for caching") | ||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CACHE_TOOL}) | ||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CACHE_TOOL}) | ||
else() | ||
message(WARNING "USE_COMPILE_CACHE enabled, but no ${CACHE_TOOL_NAME} found") | ||
endif() | ||
endif() |