summaryrefslogtreecommitdiffstats
path: root/cmake/QtSetup.cmake
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2019-02-12 12:21:30 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2019-02-19 08:59:12 +0000
commitd61b6ea30a4c7ea3a8c6100f74c88c839f66abc4 (patch)
tree33fcb82af5121b53d0ca51e0056f6e97926bdd2b /cmake/QtSetup.cmake
parentc604a1265a7c034dd898a200e8c5f2753a9e7f47 (diff)
Add support for building conveniently with ccache
Pass -DQT_USE_CCACHE=ON to enable the use of ccache. This avoids having to set up symlinks, which is useful when cross-compiling against different targets. Change-Id: I023fff105baaa538730997948aa122d2678887ce Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
Diffstat (limited to 'cmake/QtSetup.cmake')
-rw-r--r--cmake/QtSetup.cmake8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake
index a01d8a651c..6fd2b2d923 100644
--- a/cmake/QtSetup.cmake
+++ b/cmake/QtSetup.cmake
@@ -47,3 +47,11 @@ endif()
## Enable support for sanitizers:
include(${CMAKE_CURRENT_LIST_DIR}/3rdparty/extra-cmake-modules/modules/ECMEnableSanitizers.cmake)
+
+option(QT_USE_CCACHE "Enable the use of ccache")
+if(QT_USE_CCACHE)
+ find_program(CCACHE_PROGRAM ccache)
+ set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
+ set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
+ set(CMAKE_OBJC_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
+endif()