Skip to content

Build two different CMake configs in a clean and predicatable way? #2775

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

You must be logged in to vote

I would recommend CMake Presets for this. You basically create two configurePresets that define how you want CMake to generate your cache. Then you create buildPresets that will build your differently configured projects (perhaps with additional variations).

If you use Presets, then you select the one you want to be active (instead of selecting Kits) and the extension will behave the way you expect. If you set it up this way, then you only need one config in c_cpp_properties.json that looks more or less like this:

{
  "name": "myConfig",
  "configurationProvider": "ms-vscode.cmake-tools"
}

You can still set compilerPath, includePath, defines, etc as backups in case you're working with a …

Replies: 3 comments 14 replies

Comment options

You must be logged in to vote
3 replies
@bobbrow
Comment options

@jnz86
Comment options

@bobbrow
Comment options

Answer selected by jnz86
Comment options

You must be logged in to vote
4 replies
@bobbrow
Comment options

@bobbrow
Comment options

@jnz86
Comment options

@bobbrow
Comment options

Comment options

You must be logged in to vote
7 replies
@bobbrow
Comment options

@bobbrow
Comment options

@jnz86
Comment options

@bobbrow
Comment options

@jnz86
Comment options

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