cmake: Remove USE_CCACHE
authorJuan Ramos <juan@lunarg.com>
Wed, 26 Oct 2022 16:16:58 +0000 (10:16 -0600)
committerJuan Ramos <114601453+juan-lunarg@users.noreply.github.com>
Wed, 26 Oct 2022 18:01:46 +0000 (12:01 -0600)
Update docs with modern CMake approach

BUILD.md
CMakeLists.txt

index ed2fa88..d8b4b49 100644 (file)
--- a/BUILD.md
+++ b/BUILD.md
@@ -206,7 +206,6 @@ on/off options currently supported by this repository:
 | BUILD_WSI_XLIB_SUPPORT | Linux | `ON` | Build the components with Xlib support. |
 | BUILD_WSI_WAYLAND_SUPPORT | Linux | `ON` | Build the components with Wayland support. |
 | BUILD_WSI_DIRECTFB_SUPPORT | Linux | `OFF` | Build the components with DirectFB support. |
-| USE_CCACHE | Linux | `OFF` | Enable caching with the CCache program. |
 
 The following is a table of all string options currently supported by this repository:
 
@@ -217,6 +216,24 @@ The following is a table of all string options currently supported by this repos
 These variables should be set using the `-D` option when invoking CMake to
 generate the native platform files.
 
+### CCACHE
+
+There are 2 methods to enable CCACHE:
+
+1.) Set environment variables
+
+```bash
+# Requires CMake 3.17 (https://cmake.org/cmake/help/latest/envvar/CMAKE_LANG_COMPILER_LAUNCHER.html)
+export CMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/ccache
+export CMAKE_C_COMPILER_LAUNCHER=/usr/bin/ccache
+```
+
+2.) Pass in cache variables
+
+```
+cmake ... -D CMAKE_CXX_COMPILER_LAUNCHER=/usr/bin/ccache -D CMAKE_C_COMPILER_LAUNCHER=/usr/bin/ccache
+```
+
 ## Building On Windows
 
 ### Windows Development Environment Requirements
index 1309d0d..27acca8 100644 (file)
@@ -49,14 +49,6 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
 # "Helper" targets that don't have interesting source code should set their FOLDER property to this
 set(TOOLS_HELPER_FOLDER "Helper Targets")
 
-option(USE_CCACHE "Use ccache" OFF)
-if(USE_CCACHE)
-    find_program(CCACHE_FOUND ccache)
-    if(CCACHE_FOUND)
-        set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
-    endif()
-endif()
-
 # ~~~
 # Find Vulkan Headers and Loader
 # Search order: