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

Robert Goulet Robert.Goulet at autodesk.com
Wed May 6 11:12:56 EDT 2015


Well, it's just that it makes it cleaner in our build script to simply invoke cmake to build, instead of doing per-platform code. This is much cleaner.

Anyway I still believe we should be able to tell cmake to build the visual studio solution without specifying a target. That's just basic stuff.

So what's the best approach you want me to implement? "--target $proj.sln?"

-----Original Message-----
From: Brad King [mailto:brad.king at kitware.com] 
Sent: Wednesday, May 6, 2015 11:07 AM
To: Robert Goulet
Cc: cmake-developers at cmake.org
Subject: Re: [cmake-developers] Set msbuild.exe to build the solution instead of the ALL_BUILD target?

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