From 2cec77e9ec5675604d2fed59e17fbd519bcfe42a Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Wed, 12 Oct 2016 16:25:49 +0200 Subject: [PATCH] cmake: Move ccache setup to another file --- CMakeLists.txt | 14 +------------- cmake/Modules/ccache.cmake | 13 +++++++++++++ 2 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 cmake/Modules/ccache.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 861c267baa..1a6048d119 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,19 +33,7 @@ if(CMAKE_SYSTEM_PROCESSOR) endif() endif() -# Using ccache greatly improves the speed of our CI builds, let's enable for all. -# Without this, our CI can't use ccache for clang, for some reason. -find_program(CCACHE_FOUND ccache) -if(CCACHE_FOUND) - set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_FOUND}) - set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_FOUND}) - - # ccache uses -I when compiling without preprocessor, which makes clang complain. - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments -fcolor-diagnostics") - endif() -endif(CCACHE_FOUND) +include(ccache) # Remove soon? set(USE_FFMPEG ON) diff --git a/cmake/Modules/ccache.cmake b/cmake/Modules/ccache.cmake new file mode 100644 index 0000000000..35e0eeab73 --- /dev/null +++ b/cmake/Modules/ccache.cmake @@ -0,0 +1,13 @@ +# Using ccache greatly improves the speed of our CI builds, let's enable for all. +# Without this, our CI can't use ccache for clang, for some reason. +find_program(CCACHE_FOUND ccache) +if(CCACHE_FOUND) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_FOUND}) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_FOUND}) + + # ccache uses -I when compiling without preprocessor, which makes clang complain. + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments -fcolor-diagnostics") + endif() +endif(CCACHE_FOUND)