Browse Source

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

Signed-off-by: Be <be@mixxx.org>
pull/228/head
Be 11 months ago
parent
commit
76c63fa0fc
No known key found for this signature in database GPG Key ID: F4D83691462F656E
  1. 5
      BUILDING.md
  2. 22
      CMakeLists.txt

5
BUILDING.md

@ -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

22
CMakeLists.txt

@ -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

Loading…
Cancel
Save