Troubles with VS generator

Hello,

I am trying tor resolve a problem about the Visual Studio Generator.

In the CMakeLists, there are the following lines:

...
add_executable(${PROJECT_NAME} WIN32)
...
add_custom_command(
    TARGET ${PROJECT_NAME}
    POST_BUILD
        COMMAND ...
        COMMAND ...
        COMMAND ...)

When I configure the project with the Visual Studio 17 2022 generator, I get in Visual studio three extra targets: ALL_BUILD, INSTALL, ZERO_CHECK.

When I build the ALL_BUILD target, the sources are built, and the custom commands are executed. Fine.
When I build the INSTALL target, the install() commands are executed, and the custom commands are also executed. Not fine.

  • why ?
  • how to avoid the INSTALL target run also the customs command ?

Thanks.

OK, I understood what was the problems, because there are two ones:

  • the install command launched a build (I’ll open an other post about this point)
  • one the post-build command updated the output dir when doing the first build, so a post-build was run a second time.