1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-15 15:49:36 +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
No known key found for this signature in database
GPG Key ID: F4D83691462F656E
2 changed files with 20 additions and 7 deletions

View File

@ -218,6 +218,11 @@ cmake --install build
for Windows and macOS; OFF by default for Linux.
* **VCPKG_ROOT** (file path): path to vcpkg Git repository, defaults to
using the vcpkg submodule in the Tenacity repository
* **SCCACHE** (ON|OFF): whether to use sccache for compiler caching to
speed up rebuilds. ON by default if sccache is installed.
* **CCACHE** (ON|OFF): whether to use ccache for compiler caching to speed
up rebuilds. ON by default if ccache is installed. If sccache and ccache
are both installed, sccache will be prefered.
The following feature options are enabled by default if the required libraries
are found. You may explicitly disable them if you prefer or your distribution

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