CMake: Add option to use Ccache.

This commit is contained in:
Pierre Wendling 2022-11-15 13:04:22 -05:00 committed by GitHub
parent 5e61f245ab
commit a71ad40ac3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -513,6 +513,7 @@ dep_option(SDL_HIDAPI_JOYSTICK "Use HIDAPI for low level joystick drivers" O
dep_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON SDL_HIDAPI OFF) dep_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON SDL_HIDAPI OFF)
set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF) set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF)
option_string(SDL_VENDOR_INFO "Vendor name and/or version to add to SDL_REVISION" "") option_string(SDL_VENDOR_INFO "Vendor name and/or version to add to SDL_REVISION" "")
set_option(SDL_CCACHE "Use Ccache to speed up build" ON)
option(SDL_WERROR "Enable -Werror" OFF) option(SDL_WERROR "Enable -Werror" OFF)
@ -3113,6 +3114,19 @@ if (SDL_ASAN)
endif() endif()
endif() endif()
if(SDL_CCACHE)
cmake_minimum_required(VERSION 3.4)
find_program(CCACHE_BINARY ccache)
if(CCACHE_BINARY)
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_BINARY})
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_BINARY})
set(CMAKE_OBJC_COMPILER_LAUNCHER ${CCACHE_BINARY})
set(HAVE_CCACHE ON)
else()
set(HAVE_CCACHE OFF)
endif()
endif()
if(SDL_TESTS) if(SDL_TESTS)
set(HAVE_TESTS ON) set(HAVE_TESTS ON)
endif() endif()