Browse Source

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.
Eduard Voronkin 4 months ago
parent
commit
f77628e0af

+ 13 - 0
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 <path-to-build> -- -cache
+
 Configuration Variables
 -----------------------
 

+ 4 - 3
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 <https://www.fastbuild.org/docs/features/caching.html>`_
 for more information.

+ 1 - 5
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";