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

Run program before configuring #2449

Open
jasonbeach opened this issue Mar 22, 2022 Discussed in #2403 · 3 comments
Open

Run program before configuring #2449

jasonbeach opened this issue Mar 22, 2022 Discussed in #2403 · 3 comments
Labels
enhancement an enhancement to the product that is either not present or an improvement to an existing feature Feature: configure
Milestone

Comments

@jasonbeach
Copy link

jasonbeach commented Mar 22, 2022

Discussed in #2403

Originally posted by jasonbeach February 28, 2022
Is it possible to have the extension run an external program prior to configuring cmake? The immediate use case is pulling in conan dependencies. I currently have a build script that runs conan install before configuring cmake. I can create a build task that runs the script, but that doesn't work with the cmake widgets down at the bottom of the vscode window.

I assume I could add an custom target to cmake to run conan, but that seems tedious to do for multiple repos and I've tried hard to keep my cmake agnostic to conan.

Feature request:
It would be nice to be able to run a task (either a shell executable or I guess build task) before cmake configures. See above discussion. It kind of works if you check the CMake:Build Task option and then set a default task and hit the "build" button, again as described in the discussion. The only thing that's a little clumsy is that if cmake hasn't run yet then this fails because the task (in my case conan install) really needs to be run before cmake configures not before the build....from a clean build folder, you can:

  • tell cmake to configure (it'll fail because conan hasn't run ye)
  • you can attempt the build (conan install will succeed, but the build will fail, but cmake never configured)
  • configure cmake again (if you hadn't attempted to run cmake before it will succeed, but if you had depending which cmake generator in conan you're using, you may need to delete the cache so cmake can start fresh)
  • rerun the build (it succeeds this time).

I can add another task that runs cmake and make the default task depend on that, and that works, but....it's very....circumlocutious and since it's the build button you're clicking, seems wrong. It would be much better to just be able to configure a task to run to run before cmake configures.

I'm willing to help out if you can point me in the right direction. I'm a pretty strong C++ developer, but have never used typescript (I do have a little experience making changes to Javascript, but nothing I would brag about).

@bobbrow
Copy link
Member

bobbrow commented Mar 24, 2022

This seems somewhat related to this request here: #2448. I'm not sure if setting up a system of hooks for events in our extension is the right thing to do. The tasks system was designed by VS Code to do the things you are asking for. Hopefully when we complete #2452, creating configure/build/test tasks will be much more straightforward and you can chain up the tasks any way you like. You can run any of these tasks at any time using the VS Code "Run Task" action.

@bobbrow bobbrow added enhancement an enhancement to the product that is either not present or an improvement to an existing feature Feature: configure labels Mar 24, 2022
@lanyizi
Copy link

lanyizi commented Jun 9, 2022

It would be really nice if CMake tools could let me launch Visual Studio's Developer Command prompt before configuring CMake.
Currently, in order to let CMake locate the required toolset, I have to either launch CMake executable inside the developer command prompt, or start entire VS Code from it, which is not very convenient.

@gcampbell-msft gcampbell-msft added this to the Backlog milestone Dec 11, 2023
@starball5
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement an enhancement to the product that is either not present or an improvement to an existing feature Feature: configure
Projects
Status: Pending Prioritization
Development

No branches or pull requests

5 participants