[cmake-developers] Strange VS output file field

James Bigler jamesbigler at gmail.com
Thu Oct 6 13:34:23 EDT 2011


On Wed, Oct 5, 2011 at 3:45 PM, James Bigler <jamesbigler at gmail.com> wrote:

> On Fri, Aug 19, 2011 at 10:41 AM, David Cole <david.cole at kitware.com>wrote:
>
>> On Thu, Aug 18, 2011 at 4:56 PM, David Cole <david.cole at kitware.com>
>> wrote:
>> > On Thu, Aug 18, 2011 at 1:30 PM, David Cole <david.cole at kitware.com>
>> wrote:
>> >> On Tue, Aug 9, 2011 at 6:19 PM, James Bigler <jamesbigler at gmail.com>
>> wrote:
>> >>> I recently switched to 2.8.5 and noticed something strange.
>> >>>
>> >>> I have several files that build into a Debug|Release agnostic place.
>> If I
>> >>> build it in one then switch to the other the files don't regenerate,
>> because
>> >>> the build rule has been satisfied.
>> >>>
>> >>> With CMake 2.8.5 and VS 2010 I noticed something strange.  It wanted
>> to
>> >>> build the files in both debug and release.  I then looked at the
>> vsproj
>> >>> files and I noticed this:
>> >>>
>> >>>       <Outputs
>> >>>
>> Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|Win32'">C:\code\build-32-vs10-c40\lib\myfile_build.txt;%(Outputs)</Outputs>
>> >>>
>> >>> %(Outputs)???  Why is that in there.  If I manually remove $(Outputs)
>> then
>> >>> it stops rebuilding my files.
>> >>>
>> >>> James
>> >>>
>> >>>
>> >>> _______________________________________________
>> >>> cmake-developers mailing list
>> >>> cmake-developers at cmake.org
>> >>> http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
>> >>>
>> >>>
>> >>
>> >> The "%(Attribute)" notation means inherit the value from the same
>> >> element in my "parent". So for a file's attribute, it typically
>> >> inherits the value from the same named attribute in the project.
>> >>
>> >> In this case, I'm not entirely sure why it's there, but it's been
>> >> there right from the very first commit adding the VS 10 generator to
>> >> CMake: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7491f529
>> >>
>> >> I can't think of the reason why it might be needed off the top of my
>> >> head, so ... I'll try to remove it and see if all the tests pass. If
>> >> they do, I suppose it should be ok to remove it. Does anybody else
>> >> reading this thread have any other information?
>> >>
>> >> Thanks,
>> >> David
>> >>
>> >
>> > I constructed a custom build command that runs a batch file and
>> > outputs a text file solely via the VS10 IDE... and there was no
>> > "%(Outputs)" in the vcxproj file. So I think it's safe to remove this.
>> > I'll push a change that does that.
>> >
>> > Thanks for the report,
>> > David
>> >
>>
>> This bug is quite possibly a report of the same thing, although, as
>> noted in the bug, I could not reproduce the problem:
>> http://public.kitware.com/Bug/view.php?id=12302
>>
>
> Drat!
>
> This doesn't actually seem to help.  I'll see if I can create a smaller
> test program that illustrates the issue.
>
> Does anyone know of a way to figure out why VS wants to build something
> similar to a "make -d"?
>
> It would be really helpful to understand what is causing VS to rebuild
> stuff.
>
> James
>

I've been buried in this for the past day and I think I might know what is
going on.  Unfortunately there doesn't appear to be an elegant solution to
this other than perhaps filing a bug with Microsoft.

>From my experimentation, it appears that custom build rules require being
registered in the custombuild.command.1.tlog file that is put into the
%(Intermediate Directory) location of the project.  Since this location is
generally different for Debug and Release builds, each configuration needs
to run *all* the custom build rules at least once to populate this file.
This the output from MSBuild when more detailed logging is enabled.

                     Forcing rebuild of all source files due to missing
command tlog
"D:\win7x64\bugs\cmake-extra-build\VS-2010\cat-file\Release\custombuild.command.1.tlog".
(TaskId:14)

I'm not sure how to work around this aside from putting all non
configuration dependent targets into a special project that has an
intermediate directory that isn't %(Configuration) dependent.  That doesn't
seem like a lot of fun.

Why MSBuild can't simply just populate the files without actually running
the build commands if the dependencies are met seems like a little bit like
a "missing feature", however it could be the mechanism to determine
dependencies relies on that file being populated.

Unfortunately for me where I have *many* non-configuration dependent custom
build rules I have to rebuild all the files for each configuration. :(

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20111006/41b23f42/attachment.html>


More information about the cmake-developers mailing list