vscode-cmake-tools
vscode-cmake-tools copied to clipboard
Feature request: Allow running a custom target after configuring
Brief Issue Summary
I use vscode for some QT Projekts, there require to run some tools to generate header / source files.
The problem is, that code indexers and other tools would ideally require those generated files. Also features like recompiling a source-file wont work because of missing generated files.
What needs to be done in my case:
# configure
cmake -DCMAKE_GLOBAL_AUTOGEN_TARGET=ON <PATH>
# post-configure
cmake --build . --target autogen
# only now many features will work correctly
I would like if I could configure a set of "post-configure" targets, like
"cmake.configurePostTarget": [
"autogen"
]
vscode should configure, then potentially check if the targets exists and start them or just try running them (failure is not fatal).
CMake Tools Diagnostics
No response
Debug Log
No response
Additional Information
No response
@nolange It seems that your post-configure suggestion is to build the target. Instead of adding a post-configure step, couldn't you just build that target? You could possibly even create a task that does both of these steps.
it is a build target, but it only generates header. sure i can do it manually now - thats what i do.
what i want is having this configured globally and done automatically everytime the project is configured ( cmake is run explicitely by the plugin)
@nolange Ah, thanks for the additional understanding.
To make it clear, your ask is that there be some global CMake extension setting that a user can enable or set for specific targets, that always has the extension immediately build after configure.
Marking this as a feature request and putting it in our backlog for consideration for upcoming releases based on bandwidth. Thanks!
with cmake 3.31 there is now a dedicated codegen target for some generators.
with cmake 3.31 there is now a dedicated codegen target for some generators.
It would be really helpful to just having a setting that runs the codegen target. This will play really well with language servers(e.g. clangd)
Current experience:
- Configure
- clangd indexing partially runs because it is unable to find headers that are code generated (protofbuf codegen is a big example)
- run your codegen target manually
- Then indexing works
New experience:
- Configure (extension figures out to run the
codegentarget) - clangd is happy and everyone is happy
Yeah, the codegen target doesn't make that much sense if you have to go out of your way to run it when it's intended purpose was to be automatically run by IDEs. I was hoping that would exactly be what happens when I use the CODEGEN option for my custom commands.