summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt15
-rwxr-xr-xdo_cmake.sh5
2 files changed, 19 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4c12edd9c12..b2a9334a5cf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -83,6 +83,21 @@ if(WITH_CCACHE)
endif()
endif(WITH_CCACHE)
+option(WITH_SCCACHE "Build with sccache.")
+if(WITH_SCCACHE)
+ if(CMAKE_C_COMPILER_LAUNCHER OR CMAKE_CXX_COMPILER_LAUNCHER)
+ message(WARNING "Compiler launcher already set. stop configuring sccache")
+ else()
+ find_program(SCCACHE_EXECUTABLE sccache)
+ if(NOT SCCACHE_EXECUTABLE)
+ message(FATAL_ERROR "Can't find sccache. Is it installed?")
+ endif()
+ message(STATUS "Building with sccache: ${SCCACHE_EXECUTABLE}, SCCACHE_CONF=$ENV{SCCACHE_CONF}")
+ set(CMAKE_C_COMPILER_LAUNCHER ${SCCACHE_EXECUTABLE})
+ set(CMAKE_CXX_COMPILER_LAUNCHER ${SCCACHE_EXECUTABLE})
+ endif()
+endif(WITH_SCCACHE)
+
option(WITH_MANPAGE "Build man pages." ON)
if(WITH_MANPAGE)
find_program(SPHINX_BUILD
diff --git a/do_cmake.sh b/do_cmake.sh
index 8177e726396..ea32547c071 100755
--- a/do_cmake.sh
+++ b/do_cmake.sh
@@ -58,7 +58,10 @@ fi
ARGS+=" -DWITH_PYTHON3=${PYBUILD}"
-if type ccache > /dev/null 2>&1 ; then
+if type sccache > /dev/null 2>&1 ; then
+ echo "enabling sccache"
+ ARGS+=" -DWITH_SCCACHE=ON"
+elif type ccache > /dev/null 2>&1 ; then
echo "enabling ccache"
ARGS+=" -DWITH_CCACHE=ON"
fi