I have a CMake file that generates VS2015 solution file MyApp.sln. I build MyApp.sln with the following commands separately for each configuration:
msbuild MyApp.sln /property:Configuration=Debug
msbuild MyApp.sln /property:Configuration=RelWithDebInfo
msbuild MyApp.sln /property:Configuration=Release
I wonder if anyone knows how to build all the configurations with a single msbuild command. Probably CMake can generate some 'All' configuration, for example?
My question is a bit different from How can I build all with MSBuild from the command line?, because I do not modify MyApp.sln file manually, but it is generated by CMake, so I need either some option in CMake to create 'all' target or call msbuild in a way it builds all the configurations.
This is a bit silly, but you can add a custom target to CMake that causes the project build itself:
You get the idea... Note that CMake can build its own projects, so there is no need to resort to MSBuild at all.
While this works fine, I would rather
configure_file
a batch script that does the same thing to a location that works for your needs. That will definitely raise fewer eyebrows than the custom command above.