Skip to content

Commit

Permalink
rafactor: optimize ccache configuration (#64)
Browse files Browse the repository at this point in the history
Signed-off-by: msclock <[email protected]>
  • Loading branch information
msclock authored Apr 1, 2024
1 parent 1433269 commit 2e89e36
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions cmake/build/Ccache.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ set(USE_CCACHE
ON
CACHE BOOL "use ccache to speed up compiling.")

message(STATUS "Use Ccache with USE_CCACHE: ${USE_CCACHE}
Ccache Options:
USE_CCACHE: If use ccache to speed up compiling. Default is ON.")

if(NOT USE_CCACHE)
message(STATUS "Disable ccache")
message(STATUS "Disable ccache because of USE_CCACHE is OFF")
return()
endif()

Expand All @@ -23,14 +27,14 @@ find_program(
NAMES ccache
DOC "ccache executable")

if(CCACHE_COMMAND)
message(STATUS "Activate ccache: ${CCACHE_COMMAND}")
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_COMMAND}")
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_COMMAND}")

# set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)

# set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
else()
if(NOT CCACHE_COMMAND)
message(WARNING "Disable ccache because of no ccache installed")
return()
endif()

set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_COMMAND}")
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_COMMAND}")

# set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)

# set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)

0 comments on commit 2e89e36

Please sign in to comment.