microsoft / microsoft/vscode-cmake-tools

Run program before configuring

Open
#2,449 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Feature: configure
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

Discussed in https://github.com/microsoft/vscode-cmake-tools/discussions/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).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the CMake:Configure and CMake:Build Task flows, including how the VS Code build button invokes tasks. Define done as allowing a configured shell or build task such as conan install to run before CMake configuration, without the repeated configure/build workaround described here.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, typescript
Domain
build-system, developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.