Use ccache in builds when it is present

This commit is contained in:
Username404 2021-08-27 12:08:56 +02:00
parent 1992e1d42b
commit 871ebabb11
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 6 additions and 0 deletions

View File

@ -36,6 +36,12 @@ if (NOT MSVC)
endif()
set(CMAKE_CXX_FLAGS_RELEASE "-Os")
find_program(CCACHE_PRESENT ccache)
if(CCACHE_PRESENT)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_PRESENT)
if ((${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) OR (${CMAKE_CXX_COMPILER_ID} STREQUAL Clang))
set(CMAKE_CXX_FLAGS "-flto ${CMAKE_CXX_FLAGS} -pipe -fstack-protector-strong -fstack-clash-protection -fexceptions")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffunction-sections -fdata-sections -fmerge-all-constants -ftree-vectorize")