Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change the startup project of a Visual Studio solution via CMake?

I am using CMake to generate Visual Studio projects. Everything works fine except one thing.

The startup project in the solution is always ALL_BUILD. How do I change the startup project to the real project I want via CMake?

like image 287
giggle Avatar asked Sep 05 '11 06:09

giggle


People also ask

How do I remove a project from Visual Studio startup?

Select a project and right click, then select 'Remove from StartUp Projects...'

How do I change the startup project in Vscode?

In Visual Studio, you can get this done by – right click on the project, and choose “ Set as Startup project" . If the project has multiple classes with Main , in project Properties, Application tab, select the class from the Startup object dropdown.


1 Answers

CMake now supports this with versions 3.6 and higher through the VS_STARTUP_PROJECT directory property:

cmake_minimum_required(VERSION 3.6) project(foo) # ...  add_executable(bar ${BAR_SOURCES}) set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT bar) 

This will set bar as the startup project for the foo.sln solution.

like image 120
ComicSansMS Avatar answered Oct 11 '22 18:10

ComicSansMS