Open nikolaseu opened 3 weeks ago
I'm having the same problem. It is making it impossible to use CMake Tools with a conan based project, because conan creates a preset file for CMake to find all its generated CMake modules.
@nikolaseu @wrightleft Thanks for letting us know, could you all also test the previous official release version before 1.18.41? I'm wanting to understand if this is a regression, or if this is an already present issue. Thanks!
@nikolaseu For context on why we don't use --preset
, this is for numerous reasons, but the simplest being that the guidance provided by Kitware for IDE integration is to avoid using --preset
. There are additional reasons based on implementation requirements, but that is the simplest one.
@nikolaseu For context on why we don't use
--preset
, this is for numerous reasons, but the simplest being that the guidance provided by Kitware for IDE integration is to avoid using--preset
. There are additional reasons based on implementation requirements, but that is the simplest one.
Thanks! It's always an issue in Windows, I workaround it by setting the PATH before launching vscode but I need two different envs for debug and release 😞 . QtCreator is better in that sense (without presets at least).
I was hoping CMakePresets would help, since it works from the command line. But I was not using presets before. The previous version probably has the same issue since it's not a bug if I understand you correctly.
Maybe this could be an option? It seems useful to have something that works exactly as the command line.
@nikolaseu Thank you for reporting this issue. Regarding this issue, we have tried to reproduce the issue using a simple demo project: my_project.zip , but we do not seem to be able to reproduce the issue you mentioned. In order to investigate further, could you please provide us with a simple project that can reproduce this issue. We are looking forward to hearing from you.
ENV: VSCode:1.90.0 CMake 工具:v1.81.41 C/C++:v1.20.5
Actual results:
Hi @v-frankwang
That project doesn't need any DLL that is not in the PATH, you don't have any runtime dependency. How are you checking/evaluating if it's using the preset correctly?
I will try to make a basic example.
Using the x64-release preset in both cases, running ctest fails in vscode but works on command line.
Command line usage (from a VS2022 developer command prompt)
cmake --preset x64-release
cmake --build --preset x64-release --target all
ctest --preset x64-release
I don't have the regular "Visual Studio" IDE but I'm told this works fine there
@gcampbell-msft I reproduced the issue based on the project provided by the user, here are the steps to reproduce it:
ENV: VS Code: 1.90.0 CMake tools: 1.18.42 C/C++:1.20.5
Actual result: Run Test fails when you click Run Test in the Test Explorer window, but succeeds when you run it from the command line.
Brief Issue Summary
I am using
CMakePresets.json
to include some extra necessary folders in the PATH. I also use google testgtest_discover_tests()
. I can build and run tests successfully from the command line (using CMake's--preset
).But when I try to build from vscode, it fails. The command executed by vscode is different, it's not including the
--preset
argument, even when I have correctly selected and configured with the right preset (the build preset is also correctly selected). It seems to parse the preset file and add the arguments manually? Why is that?In my case the build fails because
gtest_discover_tests()
cannot run the executable (to discover the tests) because the required DLLs are not in the PATH:In addition, if I configure and build correctly from the command line (using
--preset
), then running the tests from the "Testing" panel also fail withExit code 0xc0000135
, thectest
command is again not including the--preset
argument, so the environment variables are not used as defined in the preset. As mentioned earlier, runningctest
from the command line (with--preset
) works correctly.I already tried the latest stable version (v1.18.41) and pre-release version (v1.19.3), both have the same issue.
CMake Tools Diagnostics
Debug Log
No response
Additional Information
No response