# Preserving build settings for CMake GUI

**URL:** https://discourse.cmake.org/t/preserving-build-settings-for-cmake-gui/3297
**Category:** Usage
**Tags:** os:linux
**Created:** [May 12, 2021, 8:55am UTC](https://discourse.cmake.org/t/preserving-build-settings-for-cmake-gui/3297 "2021-05-12T08:55:01Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![pauljurczak](https://discourse.cmake.org/user_avatar/discourse.cmake.org/pauljurczak/32/1418_2.png) [@pauljurczak](https://discourse.cmake.org/u/pauljurczak)
#### Post date: [May 12, 2021, 8:55am UTC](https://discourse.cmake.org/t/preserving-build-settings-for-cmake-gui/3297/1 "2021-05-12T08:55:02Z")

</div>

I’m using CMake GUI to build large projects like OpenCV. There is over 20 settings I have to change from defaults while experimenting with different build scenarios. What is the way to preserve these settings when I erase `build` directory and start from scratch?

Here is my build directory:

```auto
paul@desktop:~/opencv/build$ ls
3rdparty CMakeVars.txt doc OpenCVConfig-version.cmake test-reports
a.out configured downloads opencv_data_config.hpp text_config.hpp
apps CPackConfig.cmake include OpenCVDetectCudaArch.o tmp
bin CPackSourceConfig.cmake install_manifest.txt OpenCVModules.cmake unix-install
CMakeCache.txt CTestTestfile.cmake lib opencv_python_tests.cfg version_string.tmp
CMakeDownloadLog.txt custom_hal.hpp Makefile opencv_tests_config.hpp
CMakeFiles cvconfig.h modules python_loader
cmake_install.cmake cv_cpu_config.h opencv2 setup_vars.sh
cmake_uninstall.cmake data OpenCVConfig.cmake share

```

Would keeping some of these files or directories preserve the settings? I tried with `CMakeCache.txt` and `CMakeVars.txt`, but it didn’t work.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [May 12, 2021, 12:34pm UTC](https://discourse.cmake.org/t/preserving-build-settings-for-cmake-gui/3297/2 "2021-05-12T12:34:25Z")

</div>

I don’t see a way to provide a cache initialization file (the `-C` flag) in the GUI. However, there are [cmake presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html) which may be able to help with this.

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [May 12, 2021, 12:45pm UTC](https://discourse.cmake.org/t/preserving-build-settings-for-cmake-gui/3297/3 "2021-05-12T12:45:43Z")

</div>

Yes, presets would be my go-to feature for this now. I use them for exactly this reason, among others.

---

<div class="post-metadata">

### Author: ![kyle.edwards](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@kyle.edwards](https://discourse.cmake.org/u/kyle.edwards)
#### Post date: [May 12, 2021, 12:46pm UTC](https://discourse.cmake.org/t/preserving-build-settings-for-cmake-gui/3297/4 "2021-05-12T12:46:44Z")

</div>

+1. This is exactly what presets were designed for.
