Description
Brief Issue Summary
I'm trying to configure a dev container for out team so we all have the same setup and new members don't need to configure anything. This is kinda of a reproduction of out project, we have several libraries and executables, each one with its configurations. For the example project I've made there are 2 libs and an executable with 2 build configurations for each. As shown in the video I have the 2 targets but when I ctrl+click a function that has different sources in each target the intellisense doesn't know where to take me. Since I have selected the SIL configuration, I'd expect the intellisense to take me to the source of source_sil
Code_SZuWZzBrCQ.mp4
CMake Tools Diagnostics
{
"os": "linux",
"vscodeVersion": "1.100.2",
"cmtVersion": "1.20.53",
"configurations": [
{
"folder": "/workspaces/cmake_dev_test/ProjectApp",
"cmakeVersion": "4.0.2",
"configured": false,
"generator": "",
"usesPresets": true,
"compilers": {}
},
{
"folder": "/workspaces/cmake_dev_test/LibB",
"cmakeVersion": "4.0.2",
"configured": false,
"generator": "",
"usesPresets": true,
"compilers": {}
},
{
"folder": "/workspaces/cmake_dev_test/items/sub_repo/code/LibA",
"cmakeVersion": "4.0.2",
"configured": false,
"generator": "",
"usesPresets": true,
"compilers": {}
},
{
"folder": "/workspaces/cmake_dev_test",
"cmakeVersion": "4.0.2",
"configured": true,
"generator": "Ninja",
"usesPresets": true,
"compilers": {
"C": "/usr/bin/cc",
"CXX": "/usr/bin/c++"
}
}
],
"cpptoolsIntegration": {
"isReady": true,
"hasCodeModel": true,
"activeBuildType": "Debug",
"buildTypesSeen": [
"Debug"
],
"requests": [],
"responses": [],
"partialMatches": [],
"targetCount": 6,
"executablesCount": 2,
"librariesCount": 4,
"targets": [
{
"name": "LibA__base",
"type": "STATIC_LIBRARY"
},
{
"name": "LibA__sil",
"type": "STATIC_LIBRARY"
},
{
"name": "LibB__base",
"type": "STATIC_LIBRARY"
},
{
"name": "LibB__sil",
"type": "STATIC_LIBRARY"
},
{
"name": "ProjectApp__base",
"type": "EXECUTABLE"
},
{
"name": "ProjectApp__sil",
"type": "EXECUTABLE"
}
]
},
"settings": [
{
"communicationMode": "automatic",
"useCMakePresets": "always",
"configureOnOpen": true
},
{
"communicationMode": "automatic",
"useCMakePresets": "always",
"configureOnOpen": true
},
{
"communicationMode": "automatic",
"useCMakePresets": "always",
"configureOnOpen": true
},
{
"communicationMode": "automatic",
"useCMakePresets": "always",
"configureOnOpen": true
}
]
}
Debug Log
// configure
[main] Configuring project: cmake_dev_test
[proc] Executing command: /usr/bin/cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DBUILD_TARGET=base -DCMAKE_BUILD_TYPE=Debug -S/workspaces/cmake_dev_test -B/workspaces/cmake_dev_test/out/build/base -G Ninja
[cmake] -- The C compiler identification is GNU 11.3.0
[cmake] -- The CXX compiler identification is GNU 11.3.0
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: /usr/bin/cc - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: /usr/bin/c++ - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Building all configurations: base and sil
[cmake] -- Configuring done (0.2s)
[cmake] -- Generating done (0.0s)
[cmake] CMake Warning:
[cmake] Manually-specified variables were not used by the project:
[cmake]
[cmake] BUILD_TARGET
[cmake]
[cmake]
[cmake] -- Build files have been written to: /workspaces/cmake_dev_test/out/build/base
// build
[main] Building folder: /workspaces/cmake_dev_test/out/build/base
[build] Starting build
[proc] Executing command: /usr/bin/cmake --build /workspaces/cmake_dev_test/out/build/base --target ProjectApp__base ProjectApp__sil --
[build] [1/12] Building CXX object LibB/CMakeFiles/LibB__sil.dir/sources/LibB.cpp.o
[build] [2/12] Building CXX object ProjectApp/CMakeFiles/ProjectApp__base.dir/sources/main.cpp.o
[build] [3/12] Building CXX object LibB/CMakeFiles/LibB__base.dir/sources/LibB.cpp.o
[build] [4/12] Building CXX object ProjectApp/CMakeFiles/ProjectApp__sil.dir/sources_sil/main.cpp.o
[build] [5/12] Building CXX object items/sub_repo/code/LibA/CMakeFiles/LibA__base.dir/sources/LibA.cpp.o
[build] [6/12] Building CXX object items/sub_repo/code/LibA/CMakeFiles/LibA__sil.dir/source_sil/LibA.cpp.o
[build] [7/12] Linking CXX static library items/sub_repo/code/LibA/libLibA__base.a
[build] [8/12] Linking CXX static library items/sub_repo/code/LibA/libLibA__sil.a
[build] [9/12] Linking CXX static library LibB/libLibB__base.a
[build] [10/12] Linking CXX static library LibB/libLibB__sil.a
[build] [11/12] Linking CXX executable bin/ProjectApp__base
[build] [12/12] Linking CXX executable bin/ProjectApp__sil
[driver] Build completed: 00:00:00.277
[build] Build finished with exit code 0
Additional Information
That is the current state of the project I've made to test this. I don't know if I'm configuring this the best way possible. In our real project each library/executable has at least 3 different targets (one for each microcontroller) and most have more than 3 depending on the requirements.
In this example there are 2 libraries with 1 executable and the dependencies are straight foward, base targets depend on base targets and sil targets depend on sil targets, but in our real project the LibraryA target abc may depend on LibraryB target xyz, so I decided to make the cmake files declaring all targets for each project, I don't know if that's the best way of doing it, specially since it seems like the compiler_commands.json file has all the files instead of just the ones from the current preset. I'm kinda lost on how to configure all of this
Metadata
Metadata
Assignees
Labels
Type
Projects
Status