[cmake-developers] Set msbuild.exe to build the solution instead of the ALL_BUILD target?

Brad King brad.king at kitware.com
Wed May 6 11:07:16 EDT 2015


On 05/05/2015 04:57 PM, Robert Goulet wrote:
> This is a major issue because when building with msbuild.exe,
> specifying a target project will not respect the rules set in
> the solution file, which might have some projects disabled by
> the EXCLUDE_FROM_DEFAULT_BUILD cmake target property.

The VS solution files are an extra generator-specific piece that
do not really fit in CMake's general model of the build rules.
Everything related to them requires special interfaces like
EXCLUDE_FROM_DEFAULT_BUILD.

On 05/05/2015 05:02 PM, Robert Goulet wrote:
>   else if ( realTarget == "build" )
>     {
>     makeCommand.push_back(std::string(projectName)+".sln");
>     makeCommand.push_back("/t:Build");
>     }

The existing "clean" special case corresponds to "make clean".
We can't add a special case for the "build" name because that
is not reserved as a special cmake-defined target name.  We
could use a more obscure name though, such as "default_build"
or ".sln".  The other VS generators would have to learn to honor
this name too.

One could also teach CMake to recognize "--target $proj.sln"
as a special case for building the entire solution.

If you want precise control over the msbuild invocation, why not
just invoke it directly?

-Brad



More information about the cmake-developers mailing list