[cmake-developers] Visual Studio dependencies bug work-around
Brad King
brad.king at kitware.com
Wed Apr 15 14:05:00 EDT 2015
On 04/15/2015 12:31 PM, Robert Goulet wrote:
> defined EXCLUDE_FROM_DEFAULT_BUILD_RELEASE 1 on Bar
[snip]
> All seems to work from within Visual Studio
Yes, that property is documented to work only for the "Build Solution"
button in the IDE. The IDE has knowledge of dependencies written in
the .sln files. MSBuild uses the ProjectReferences settings in the
individual .vcxproj files if it doesn't load the .sln.
> Visual Studio doesn't seems to support dependencies by configuration.
AFAIK the IDE doesn't. I just checked and MSBuild does support a
Condition="..." attribute on each ProjectReferences element that
can be used to make it per-config, but the IDE has no way to set
this through its interface.
It is also a CMake limitation in that our target dependency graph
is not represented with the configuration as a parameter. The
cmComputeTargetDepends::CollectTargetDepends method computes a
union of the dependencies required by each configuration. It may
be non-trivial to add such a parameter and move the union later
to generators for build systems that do not support per-config
inter-target dependencies.
> msbuild.exe foo.sln /t:INSTALL /p:Configuration=Release
> ...didn't work because INSTALL is never part of any targets in the solution
Yes, msbuild refuses to recognize targets not marked as part of the
default build in the solution. One has to build INSTALL.vcxproj
directory to install with msbuild, and that of course runs into the
above problem.
I was able to get a command-line build to work using devenv:
devenv foo.sln /build Release /project INSTALL
-Brad
More information about the cmake-developers
mailing list