Vscode-cmake-tools: Set default active workspace in workspace settings

Created on 14 Feb 2020  路  4Comments  路  Source: microsoft/vscode-cmake-tools

Brief Issue Summary

I have a workspace file that contains 3 folders, only one of them is a cmake project the second one is a cmake folder that gets included as external. autoSelectActiveFolder doesn't help me here since it might be that I don't have any file open at the moment that I open vs code and press the build button.

  • main_project

    • CMakeLists.txt (includes add_subdirectory(../common EXTERNAL_COMMON))

  • common

    • CMakeLists.txt (should not build, but cmake tools tries to, doesn't contain project())

  • other_project (not cmake, but cmake tools still asks which kit I want to use)

Expected:

I would like to see that I can set the default active folder in my project, so that I know that pressing build will actually build the default project.

Apparent Behavior:

Depending on what cmake tools chooses, it might be that I get an error, because it cannot find a CMakeLists.txt or it find one in another folder, which is actually an external folder and therefore it is not a root CMakeLists.txt. You get an error that it cannot find project() for example. I just don't want this project to build at all.

Platform and Versions

  • Operating System: Windows 10
  • CMake Version: 3.16.0
  • VSCode Version: 1.42.1
  • CMake Tools Extension Version: 1.3.0
  • Compiler/Toolchain: QNX custom toolchain
Feature Request multiroot embedded

Most helpful comment

That's fair. I'll change this into a feature request. I don't think we'd want to add a setting for the current active folder, but rather the default active folder when no other folder is set as active.

All 4 comments

Am I understanding correctly that you only want one of the folders to build?

If you set autoSelectActiveFolder to false and then pick "main_project" as the active folder (click on the status bar item or run the "select active folder" command), does that work for you?

Yes I am trying to build only one folder. I have set autoSelectActiveFolder to false and that works. It builds fine.

But when someone opens the project for the first time, that folder is not guaranteed to be the selected folder by default. Therefore I need to tell all my colleagues or document in the setup steps, that they need to set the active folder correctly when they start up the project for the first time. This is prone to errors and I would rather see that someone opens the workspace file and can start working directly from there. I think it would be best if the workspace settings can have an option where we put the active folder to build.

That's fair. I'll change this into a feature request. I don't think we'd want to add a setting for the current active folder, but rather the default active folder when no other folder is set as active.

Using multi root project should not mean, that all folders automatically contains standalone top level projects. CMakeLists.txt in these folders can be included using add(...) directive from "main" project folder CMakeLists.txt and are not means to be configured as self-contained.

There should be option to exclude configuration of that folders.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MathiasMagnus picture MathiasMagnus  路  3Comments

Nightlights524 picture Nightlights524  路  3Comments

gabyx picture gabyx  路  5Comments

OleksandrKvl picture OleksandrKvl  路  3Comments

decimad picture decimad  路  6Comments