Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Several projects in one solution with cmake and visual studio

I have a Visual Studio 2010 solution with 5 projects in it, two libraries and three applications (that depend on the libraries). I would now like to migrate the build system to CMake (to also be able to compile under Linux).

I've already found out how to write a CMakeLists.txt for one project and create a .sln file out of it that compiles in VS. However, I can't find a solution to specify in a CMake file each individual projects and then automatically let CMake create a VS .sln with those 5 projects in it.

How do I have to structure my projects and CMakelists to accomplish this?

like image 937
Ela782 Avatar asked Jun 25 '12 19:06

Ela782


2 Answers

For each library, call add_library, for each application call add_executable.

like image 125
Fraser Avatar answered Sep 24 '22 16:09

Fraser


Every cmake call to add_library or add_executable creates a new project in your solution.

like image 34
totowtwo Avatar answered Sep 24 '22 16:09

totowtwo