]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: Support sccache 56734/head
authorZack Cerza <zack@redhat.com>
Thu, 14 Mar 2024 21:24:30 +0000 (15:24 -0600)
committerZack Cerza <zack@redhat.com>
Tue, 9 Apr 2024 22:39:35 +0000 (16:39 -0600)
Signed-off-by: Zack Cerza <zack@redhat.com>
CMakeLists.txt
do_cmake.sh

index 4c12edd9c12ad5d40287bb6852f8869d53c5758f..b2a9334a5cfef95388159b8aac4b9c25a9f767bf 100644 (file)
@@ -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
index 8177e72639606be85c75d363268b5a50485794db..ea32547c0715aebcc209afd3440a82b657056046 100755 (executable)
@@ -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