1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-19 17:11:12 +02:00

CMake: add options to disable sccache and ccache if they are found

Signed-off-by: Be <be@mixxx.org>
This commit is contained in:
Be
2021-08-11 18:50:36 -05:00
parent af90feeb13
commit 76c63fa0fc
2 changed files with 20 additions and 7 deletions

View File

@@ -163,20 +163,28 @@ project( Tenacity )
# Use ccache if available
find_program( CCACHE_PROGRAM ccache )
mark_as_advanced( FORCE CCACHE_PROGRAM )
if(NOT "${CCACHE_PROGRAM}" STREQUAL "CCACHE_PROGRAM-NOTFOUND")
option(CCACHE "Use ccache for compiler caching to speed up rebuilds." ON)
endif()
find_program( SCCACHE_PROGRAM sccache )
mark_as_advanced( FORCE SCCACHE_PROGRAM )
if(NOT "${SCCACHE_PROGRAM}" STREQUAL "SCCACHE_PROGRAM-NOTFOUND")
option(SCCACHE "Use sccache for compiler caching to speed up rebuilds." ON)
endif()
if( CCACHE_PROGRAM )
message( STATUS "Found ccache: ${CCACHE_PROGRAM}" )
set( CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" )
set( CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" )
elseif( SCCACHE_PROGRAM )
message( STATUS "Found sccache: ${SCCACHE_PROGRAM}" )
# Prefer sccache if both ccache and sccache are found because Windows users may have
# ccache installed with MinGW which would not work with MSVC.
if(SCCACHE)
message( STATUS "Using sccache for compiler caching to speed up rebuilds" )
set( CMAKE_C_COMPILER_LAUNCHER "${SCCACHE_PROGRAM}" )
set( CMAKE_CXX_COMPILER_LAUNCHER "${SCCACHE_PROGRAM}" )
elseif(CCACHE)
message( STATUS "Using ccache for compiler caching to speed up rebuilds" )
set( CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" )
set( CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" )
else()
message( STATUS "Could NOT find ccache nor sccache, no compiler caching enabled" )
message( STATUS "No compiler caching enabled. Install sccache or ccache to enable compiler caching." )
endif()
# Load our functions/macros