Skip to content

Cmake presets and cmake.sourceDirectory array #3059

Closed Answered by bobbrow
jankap asked this question in Q&A
Discussion options

You must be logged in to vote

When ${sourceDir} is used in CMakePresets.json, it refers to the path to the project's source directory (e.g. CMAKE_SOURCE_DIR). Reference: https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html#macro-expansion

We just happen to support a similarly named variable for consistency when resolving settings (most notably for cmake.buildDirectory) because using ${workspaceRoot} could result in path collisions when generating multiple projects in the same folder. You can use ${sourceDir} and ${sourceDirectory} interchangeably.

For your project layout, it seems to me that you could set cmake.sourceDirectory to the two root CMakeLists.txt that you have and the extension should allow you t…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gcampbell-msft
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants