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

CMake tools should not configure the project if cache is available #984

Closed
WSUFan opened this issue Dec 23, 2019 · 11 comments
Closed

CMake tools should not configure the project if cache is available #984

WSUFan opened this issue Dec 23, 2019 · 11 comments
Assignees
Labels
enhancement an enhancement to the product that is either not present or an improvement to an existing feature Feature: configure Feature: settings fixed (release pending) fixed in pre-release and is pending official release IMPORTANT
Milestone

Comments

@WSUFan
Copy link

WSUFan commented Dec 23, 2019

Hi guys.

I'm new to use CMake tools for VScode. Right now I'm developing a C++ project using the Docker and VScode remote SSH. Everything works fine except for one thing. The project is managed by CMake. So I have installed the CMake extension in VScode. When I reconnect to the remote container (like reload the VScode), the CMake tool will always configure the project first (it may think I did not configure the project before but I did!!). I believe all data is mounted through outside and can be persisted. So anyone knows how to solve this thing?

Thanks

@bobbrow
Copy link
Member

bobbrow commented Dec 23, 2019

There is a setting cmake.configureOnOpen that controls whether a configure is run automatically when the folder opens. By default it should be disabled, so I'm not sure why you're seeing what you're seeing. But in general, the extension will do a configure before building if one hasn't been run yet in that session because it doesn't know the state of the project when it loads.

@WSUFan
Copy link
Author

WSUFan commented Dec 23, 2019

Thanks for replying. Actually I disable that setting. And what do you mean by "current session"? The session state is not saved somewhere? Because when I reopen the VScode I will need to configure the project again even I have already configured it before.

@bobbrow
Copy link
Member

bobbrow commented Dec 23, 2019

The "current session" is when you open the folder in VS Code. If you close and reopen the folder that starts a new "session".

In any case, we recommend that CMake Tools configure your project on open and will probably change the default for the setting to true in a future release. The C++ extension can't ask CMake Tools for project information so that IntelliSense will work better unless CMake Tools has run the configure step.

@WSUFan
Copy link
Author

WSUFan commented Dec 23, 2019

Ok. That makes sense. Is that possible that the tool can cache the current session state so that it does not need to run the configuration again when each time I open the same folder?

@bobbrow
Copy link
Member

bobbrow commented Dec 26, 2019

We'll have to look into it. It seems like CMake should allow us to get project information if the cache file is present. It will be up to the user to ensure the cache is up to date in this case though.

How long does your configure step take?

@WSUFan
Copy link
Author

WSUFan commented Dec 26, 2019

Sounds great. My project is very big so it takes a couple of minutes to configure.

@bobbrow bobbrow added enhancement an enhancement to the product that is either not present or an improvement to an existing feature Feature: configure and removed question labels Dec 26, 2019
@bobbrow bobbrow mentioned this issue Jan 15, 2020
3 tasks
@andreeis andreeis added this to the Backlog milestone Jan 24, 2020
@stefanweiser
Copy link

stefanweiser commented Apr 2, 2020

In my case vscode 1.43.2 seem to configure always after stopping the build. Even with cmake.configureOnOpen set to true. Then after opening vscode configures the workspace once. When I build then no configuration is done. When I let the build finish not configuration is done again, but if I interrupt the build and build it again, it will unnecessarily configure the workspace again.

I think that it is completely useless to run CMake configure step if there already is a CMake configuration in the directory. In this case let CMake decide whether to run configure step again or not. So letting the user decide would be great.

@bobbrow bobbrow modified the milestones: Backlog, On Deck Apr 2, 2020
@andreeis andreeis modified the milestones: On Deck, 1.4.0 Apr 2, 2020
@bobbrow bobbrow changed the title CMake tool always configures the project Used cached code model when using file-api mode and project has not been configured Apr 8, 2020
@bobbrow bobbrow changed the title Used cached code model when using file-api mode and project has not been configured CMake tools should not configure the project if cache is available Apr 8, 2020
@bobbrow bobbrow added the fixed (release pending) fixed in pre-release and is pending official release label May 7, 2020
@andreeis
Copy link
Contributor

CMake Tools 1.4.0 Beta is available on GitHub.
https://github.com/microsoft/vscode-cmake-tools/releases/tag/1.4.0-beta

Please try it out and let us know if you encounter any issues.

@andreeis
Copy link
Contributor

This fix is available in CMake Tools #1.4.0 which has been released.

@wkjarosz
Copy link

This issue doesn't seem to be entirely resolved. I have two variants Debug vs. Release, which use two different build directories ("build/Debug" and "build/Release") and therefore caches. Even if I set "Skip over the configure process if cache is present", configure seems to always rerun upon switching between the variants. Is there currently a way to prevent this, or does this require a fix?

I can confirm that in other circumstances this fix/option seems to do the right thing: If I simply stop the build and restart (without switching variants) I see the following in the output and configure is indeed skipped:

The extension determined that a configuration is needed at this moment but we are skipping because the setting cmake.skipConfigureWhenCachePresent is ON. Make sure the CMake cache is in sync with the latest configuration changes.

@bobbrow
Copy link
Member

bobbrow commented Sep 15, 2021

For this issue we prioritized getting the extension to provide IntelliSense configurations when a workspace opens and cmake.configureOnOpen is not set to true. Your case is also valid, but I will create a new issue for it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement an enhancement to the product that is either not present or an improvement to an existing feature Feature: configure Feature: settings fixed (release pending) fixed in pre-release and is pending official release IMPORTANT
Projects
None yet
Development

No branches or pull requests

5 participants