Skip to content

Added option to override config with local file.#301

Open
sebu06 wants to merge 1 commit intoCivitasv:masterfrom
sebu06:local_config
Open

Added option to override config with local file.#301
sebu06 wants to merge 1 commit intoCivitasv:masterfrom
sebu06:local_config

Conversation

@sebu06
Copy link
Copy Markdown

@sebu06 sebu06 commented Feb 18, 2025

Since I often use cmake-tools on different machines, I would like to have an option to store my settings in the repo rather than in the session store, that is only locally available. This commit adds the option to add a file ".cmake-tools.lua" to the repo and override the cmake-tools settings in it.

@lceWolf lceWolf requested a review from Civitasv February 22, 2025 23:06
Comment thread lua/cmake-tools/session.lua Outdated
local osys = require("cmake-tools.osys")
local utils = require("cmake-tools.utils")

local function findFileInDirOrParent(dir, fname)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change it to find_file_in_dir_or_parent.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I think it's better to just search .cmake-tools.lua from current working directory. Current approach may lead to recursion bug. Sometimes we better restrict our power.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change it to find_file_in_dir_or_parent.

done

And I think it's better to just search .cmake-tools.lua from current working directory. Current approach may lead to recursion bug. Sometimes we better restrict our power.

I find it rather useful, since it allows me to set good presets for all my repos in the parent folder and fine tune them in the individual ones if needed...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I too think this search should be limited (similar how CMakeLists.txt is found)

@Civitasv
Copy link
Copy Markdown
Owner

Currently, it seems will still create cache file even .cmake-tools.lua file exists, which I don't think quite good.

@sebu06
Copy link
Copy Markdown
Author

sebu06 commented Sep 18, 2025

Currently, it seems will still create cache file even .cmake-tools.lua file exists, which I don't think quite good.

You are right, this should be fixed now

@lceWolf
Copy link
Copy Markdown
Collaborator

lceWolf commented Mar 30, 2026

@sebu06 sorry for the late reply. Mind resolving the merge conflicts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants