[CMake] How to change default target in solution?

Bill Hoffman bill.hoffman at kitware.com
Fri Mar 11 11:22:48 EST 2011


On 3/11/2011 9:56 AM, aaron.meadows at thomsonreuters.com wrote:
> You can't.
>
> The default target is stored in the .suo file.  That file is generated
> by visual studio when it loads the solution file.  The rules that Visual
> studio uses for chosing the default target are not published and don't
> seem to make a lot of sense.  The reason that ALL_BUILD is marked as the
> default target has to do with the order of projects listed in the
> solution file generated by CMake.  That order is no adjustable in CMake,
> and other factors can change the behavior.
>
> I had a conversation on the list this week about it already, with
> regards to the project folders and getting ALL_BUILD to be placed in the
> default cmake projects folder.  I played around with the generated
> solution file, forcing ALL_BUILD into that folder manually, and it then
> chose the INSTALL target as the default, even though all I had done was
> add a refrence to the ALL_BUILD project in the folder grouping.  Weird.
>
> You'll just have to chose the default target manually after loading the
> solution.
>

Actually, I think that VS picks the default target based on the order 
that it shows up in the .sln file.  I have never gotten around to 
verifying this or seeing if there was a way to add a property that would 
do the re-order.  But, if this does work, it might actually be possible 
to implement this.

-Bill


More information about the CMake mailing list