Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] Allow disable automatic CMake configure when saving CMakeLists.txt #1259

Closed
tt4g opened this issue May 22, 2020 · 15 comments
Closed
Labels
Feature: configure fixed (release pending) fixed in pre-release and is pending official release
Milestone

Comments

@tt4g
Copy link

tt4g commented May 22, 2020

This pull request #1196 added new feature to automatic configure CMake when saving CMakeLists.txt.

This is a great feature that integrates CMake projects with IntelliSense.
However, there were things I wanted to turn off this feature.
Specifically, when working on a project that has multiple CMakeLists.txt, running CMake configure every time CMakeLists.txt is saved will hinder my work.

Imagine a project with the following structure:

.
+-- include
|   +-- CMakeLists.txt // Add `foo.hpp`, etc header files to project.
|   +-- foo.hpp
+-- src
|   +-- CMakeLists.txt // Add `cpp.hpp`, etc source files to project.
|   +-- foo.cpp
+-- CMakeLists.txt // Calls `add_subdirectory(include)` and `add_subdirectory(src)` as aggregators.

My project has many source and header files, I have divided the project source file declarations in this way.

This project is using Qt. The problem is that Qt must perform the task of scanning the source files and generating additional source files (Qt MOC sources) every time CMake configure time.
I have to update the CMakeLists.txt twice to add the header and source files.
CMake configure starts when the first CMakeLists.txt is saved, and it also starts scanning the source.
I can't work on it until I've finished scanning the source.

Could you add an option to turn off the this feature to get around the problem?
I'm sure there are others besides me who would like to turn this feature off for projects that perform time-consuming tasks in the CMake configure step.

@gvcallen
Copy link

+1

1 similar comment
@wutiantong
Copy link

+1

@fatfatson
Copy link

+1
I'm working on a workspace and there's only one folder has CMakeList.txt, everytime I modify&save it, vscode always shows error about something like "no CMakeList in other folder"

image

even though I click the "Don't show again", it still appear everytime.

@andreeis andreeis added this to the 1.4.1 milestone Jun 2, 2020
@bobbrow
Copy link
Member

bobbrow commented Jun 4, 2020

@fatfatson we should fix that, but did you try clicking the "Locate" button to tell the extension where the CMakeLists.txt file is? Or you can also set the cmake.sourceDirectory setting manually.

@bobbrow
Copy link
Member

bobbrow commented Jun 4, 2020

@fatfatson or are you saying you have multiple folders added to a workspace and only one of them has a CMakeLists.txt (and it's not the one called 'pi' in your screenshot)? If that is the case, can you create a new issue for that since this issue is covering a different problem? Thank you!

@thothothotho
Copy link

I agree this is critical to be able to opt out from a feature like this. In fact, I would have even done it as an opt in feature. A cmake run can have many unexpected side effects, it can call any command.
IMHO, this is very dangerous to let it run on save, without the user's blessing.

@andreeis
Copy link
Contributor

andreeis commented Jun 4, 2020

Yes we are going to fix this for the soon upcoming 1.4.1 update release.

@PeterJeff
Copy link

Yes we are going to fix this for the soon upcoming 1.4.1 update release.

Awesome, it's been tough when I do mass find replaces and get spammed with hundreds of "Configuration is already in progress." blasting my window.

@kisielk
Copy link

kisielk commented Jun 10, 2020

@fatfatson or are you saying you have multiple folders added to a workspace and only one of them has a CMakeLists.txt (and it's not the one called 'pi' in your screenshot)? If that is the case, can you create a new issue for that since this issue is covering a different problem? Thank you!

Not the OP but I also have this problem. In my case I have some folders added to the workspace that do not have CMakeLists. What's worse is when I click "Don't show again" it seemingly turns off the CMake extension (none of the shortcuts work any more, status bar items disappear) until I manually run the "Configure" command from the command palette.

@jheaff1
Copy link

jheaff1 commented Jun 15, 2020

Looking forward to being able to disable configure-on-save

@bobbrow bobbrow added the fixed (release pending) fixed in pre-release and is pending official release label Jun 17, 2020
@andreeis
Copy link
Contributor

This should be fixed in CMake Tools 1.4.1 which was published today.
Let us know if you encounter any issues with this release.

@kisielk
Copy link

kisielk commented Jun 18, 2020

@andreeis seems to have resolved the issues for me, thank you

@tt4g
Copy link
Author

tt4g commented Jun 18, 2020

@andreeis Thank you!

@badpaybad
Copy link

I got this issues too. How to enable/disable auto run cmake after save change Makelists.txt
Quite uncomfortable. I use CMake Tools version v1.8.1

@bobbrow
Copy link
Member

bobbrow commented Sep 20, 2021

Toggle this setting:
image

@github-actions github-actions bot locked and limited conversation to collaborators Jan 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Feature: configure fixed (release pending) fixed in pre-release and is pending official release
Projects
None yet
Development

No branches or pull requests