using Visual Studio 2022 Generator's install target

I just used the VS 2022 generator for the first time (3.26.4 and the vs bundled 3.64.0-msvc3) and I see the targets have a new layout when I open the solution. I have used cmake for many years. I see that I no longer get a filter called CMakeTargets with a project inside it called INSTALL like I used to but I do get a top-level project in my solution called install-distribution. What I can’t seem to figure out is how do I execute the install, I used to run the “build project” on INSTALL, running this on install-distribution does nothing. Running “build solution” just compiles and links all the targets without an install (as before).

On the command line cmake --install works as expected. I want to do this from inside the IDE like I always have.

I’ve looked in the docs page for the VS 2022 generator and it doesn’t mention any changes related to this vs2022 generator Is there somewhere else to read about this?

I’ve tried using older generators with this latest version of cmake and it behaves as it always has: there is a project called INSTALL in the solution and running “build” on it runs the installation.


  • James

I see nothing in the CMake source code about install-generator or anything that would build up such a target name. Can you try using --trace-expand when configuring to see where this string might be coming from?

OK, this is very strange, I think this is pilot error, but I can’t say for sure.

I have installed a bunch of other things, seemingly not related to cmake and now when I use the “Visual Studio 17 2022” generator to try to get the --trace-expand log I get a filter called CMakePredefinedTargets and in there the normal INSTALL project I was expecting. I cannot reproduce the failure to generate this.

I think install-distribution is part of the CMakeLists.txt setup for the particular project I’m working with.

I cannot imagine I missed this filter before, I even showed the solution to a colleague, but stranger things have happened. I’ll close this and hopefully I’ll never see it again!

thanks and sorry for the noise

  • James