From f77628e0af5d9e985b64d9a4d7f303270f64c066 Mon Sep 17 00:00:00 2001 From: Eduard Voronkin <42834212+Noxybot@users.noreply.github.com> Date: Sun, 7 Sep 2025 21:20:31 -0700 Subject: [PATCH] FASTBuild: don't set default cache path Leave only 2 option to set cache path: 1. CMake variable 2. Environment variable Update docs to reflect the changes. --- Help/generator/FASTBuild.rst | 13 +++++++++++++ Help/variable/CMAKE_FASTBUILD_CACHE_PATH.rst | 7 ++++--- Source/cmGlobalFastbuildGenerator.cxx | 6 +----- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Help/generator/FASTBuild.rst b/Help/generator/FASTBuild.rst index cfcaf2621a..4c1936824e 100644 --- a/Help/generator/FASTBuild.rst +++ b/Help/generator/FASTBuild.rst @@ -27,6 +27,19 @@ This writes a FASTBuild configuration file named ``fbuild.bff`` into These IDE files can be generated by building ``xcode`` or ``solution`` targets and will build using FASTBuild as the backend. +Caching +------- + +To enable FASTBuild caching, set the cache path using the +:variable:`CMAKE_FASTBUILD_CACHE_PATH` variable or the +``FASTBUILD_CACHE_PATH`` environment variable. + +Then build with the ``-cache`` flag: + +.. code-block:: console + + cmake --build -- -cache + Configuration Variables ----------------------- diff --git a/Help/variable/CMAKE_FASTBUILD_CACHE_PATH.rst b/Help/variable/CMAKE_FASTBUILD_CACHE_PATH.rst index ade045aa9b..486da09ef0 100644 --- a/Help/variable/CMAKE_FASTBUILD_CACHE_PATH.rst +++ b/Help/variable/CMAKE_FASTBUILD_CACHE_PATH.rst @@ -1,9 +1,10 @@ CMAKE_FASTBUILD_CACHE_PATH ---------------------------- +-------------------------- -Specifies the directory for the FASTBuild artifact cache. +Specifies the directory for the FASTBuild artifact cache in the generated file. -Defaults to :variable:`CMAKE_BINARY_DIR` ``/fbuild.cache`` if not set. +If not set, FASTBuild will use the ``FASTBUILD_CACHE_PATH`` environment +variable at build time. See the `FASTBuild caching documentation `_ for more information. diff --git a/Source/cmGlobalFastbuildGenerator.cxx b/Source/cmGlobalFastbuildGenerator.cxx index 18e0aed780..d395e2bde7 100644 --- a/Source/cmGlobalFastbuildGenerator.cxx +++ b/Source/cmGlobalFastbuildGenerator.cxx @@ -538,12 +538,8 @@ void cmGlobalFastbuildGenerator::WriteSettings() auto val = this->GetSafeGlobalSetting(FASTBUILD_CACHE_PATH); if (!val.empty()) { cacheDir = std::move(val); - } else { - // Default value. - cacheDir = - this->GetCMakeInstance()->GetHomeOutputDirectory() + "/fbuild.cache"; + cmSystemTools::ConvertToOutputSlashes(cacheDir); } - cmSystemTools::ConvertToOutputSlashes(cacheDir); WriteDivider(); *this->BuildFileStream << "// Settings\n\n";