[CMake] PREDEFINED_TARGETS_FOLDER and ALL_BUILD Target

David Cole david.cole at kitware.com
Fri Mar 4 12:58:34 EST 2011


On Fri, Mar 4, 2011 at 12:25 PM, <aaron.meadows at thomsonreuters.com> wrote:

> > It is (forced by backwards compatibility requirements) by design.
>
> >
>
> > Here is the source code where I wanted to assign it to the
> CMakePredefinedTargetsFolder:
>
> >
>
> > #if 0
>
> >       // Can't activate this code because we want ALL_BUILD
>
> >       // selected as the default "startup project" when first
>
> >       // opened in Visual Studio... And if it's nested in a
>
> >       // folder, then that doesn't happen.
>
> >       //
>
> >       // Organize in the "predefined targets" folder:
>
> >       //
>
> >       if (this->UseFolderProperty())
>
> >         {
>
> >         allBuild->SetProperty("FOLDER",
> this->GetPredefinedTargetsFolder());
>
> >         }
>
> > #endif
>
> >
>
> >
>
> > Sorry,
>
> > David
>
>
>
> Is there some reason that couldn’t be a property as well?  Or possibly a
> Policy?  I’m not sure I understand 1) why ALL_BUILD couldn’t be the default
> project from within a folder, and 2) why it needs to be the default project
> (beyond backward compatibility.).
>
> This email was sent to you by Thomson Reuters, the global news and
> information company.
> Any views expressed in this message are those of the individual sender,
> except where the sender specifically states them to be the views of Thomson
> Reuters.
>


To answer your 2 questions:

1) why ALL_BUILD couldn't be the default project from within a folder

- I'm not sure that it can't be, but empirically it appears not to be. Part
of the problem here is that nobody seems to have a good understanding or
documentation that tells us exactly how the "default startup project" is
determined in the (initial) absence of the end user's choice which is saved
in the corresponding Visual Studio Solution User Options file (*.suo). Since
that code is sensitive and we didn't want to rock the boat, the above "punt
and #if 0" (quick) approach was settled on for inclusion in the CMake 2.8.3
release

2) why does ALL_BUILD need to be the default project

- This one I can't answer. I don't understand why it even is the default
startup project anyhow. As such, it's useless. It seems to me that your
*main executable* target (although we do not have such a designation, one
would be nice) should be the default startup project, so that F5 / "menu >
Debug > Start Debugging" just works without having to manually set a startup
project. Build Solution / F7 / Ctrl+Shift+B builds ALL_BUILD regardless of
what the default startup project is.


Patches, pointers to good docs from MSFT, and suggestions are always
welcome.

After writing this, I have it in my head to add a well-known target property
that means "main executable" or "default startup project" -- but
implementing that property correctly for all versions of VS is probably more
work than I want to think about on a Friday afternoon.


Thanks for listening,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110304/f274fd7a/attachment.htm>


More information about the CMake mailing list