Nico van Bentum
Nico van Bentum

Reputation: 347

Single visual studio .sln for multiple CmakeLists.txt projects?

Let's say I have a folder structure like:

CMakeLists.txt
/ProjThatShouldProduceLib/CMakeLists.txt
/ProjThatUsesLibShouldProduceExe/CMakeLists.txt
/AnotherProjThatUsesLibShouldProduceExe/CMakeLists.txt

How do I get the root CMakeLists.txt to produce a visual studio .sln that contains all the other directories as projects?

Upvotes: 0

Views: 118

Answers (1)

Alex Reinking
Alex Reinking

Reputation: 20046

Very simple:

cmake_minimum_required(VERSION 3.22)
project(proj)

add_subdirectory(ProjThatShouldProduceLib)
add_subdirectory(ProjThatUsesLibShouldProduceExe)
add_subdirectory(AnotherProjThatUsesLibShouldProduceExe)

Upvotes: 1

Related Questions