Every time when I re-configure my project, I get the next error notifications from VS Code:
"Element with id ::.::Target1 is already registered"
"Element with id ::.::Target2 is already registered"
and other, when Target1 and Target2 are names of targets from Cmake.
This looks to be an issue with the project outline tree view. Do you have a sample project I can look at?
Have same issue
This looks to be an issue with the project outline tree view.
Yes, after I had disabled the project outline tree view, error notifications haven't shown.
Do you have a sample project I can look at?
Sorry, but I can't provide it.
@lflserg Do you have a minimal project that can reproduce the issue? I know the line and error that is being hit, but I can't mentally model how it executes. I'll need to debug into it.
@vector-of-bool project I am trying it on is huge closed source so i cant share it, sorry
Have the same issue with a project (declaring project() in CMakeLists.txt) used as submodule in another project with add_subdirectory(... EXCLUDE_FROM_ALL)
bug can be triggered with this repo:
https://github.com/rtbo/vscode-cmake-tools587
(don't forget to git submodule update --init)
Even I face the same issue with a big project,
I hit _configure_ -> it configures part of the targets , shows them in the _right pane_ and shows this error.
but it shows configuring done , and build files have been written also,
also, configuring it manually on bash by cmake .. does configure it properly, so the issue is with parsing the targets by the extension I guess.

I'm getting the same issue :/
Same error here - I think this is related to similar named subfolders added via cmakes add_directory(subdirname) if subdirname is repeated for different but same named subdirectories in different places of the project tree. Perhaps these internal elements can be prefixed with their "full" project tree path inside the extension to make them unique again?
same issue here;
it depends on multiple folders with same name in the cmake tree
I was able to fix duplicate directory structure and duplicate project names. (#1169)
There is still one issue, which causes this bug:
project->dir->target->dir
if a target is defined in a subdirectory of a project and has sources in directories, the view breaks.
CMakeLists.txt (1):
cmake_minimum_required (VERSION 3.0)
project ("base")
add_subdirectory(sub)
CMakeLists.txt (2):
add_library(test src/src.cpp)
Leaving this issue open until we release the fix.
CMake Tools 1.4.0 Beta is available on GitHub.
https://github.com/microsoft/vscode-cmake-tools/releases/tag/1.4.0-beta
Please try it out and let us know if you encounter any issues
.
This fix is available in CMake Tools 1.4.0 which has been released.
This fix is available in CMake Tools #1.4.0 which has been released.
But I get this error with CMake Tools 1.4.1.
@hotman-x can you please open a new issue with details about the problem you are having?
Most helpful comment
Leaving this issue open until we release the fix.