-
Notifications
You must be signed in to change notification settings - Fork 461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmake.getLaunchTargetFilename is broken #1692
Comments
Do you have a "Debug" target selected? It may differ from the build target. Use the command "CMake: Set as Launch/Debug target" in the palette. |
I already used that, but it did appear to do nothing. It simply closed the palette after pressing enter and nothing appeared to change. Also what do you mean with
"Debug" is the |
Does your project configure successfully? |
|
I cloned your branch and on windows the debug target setting works fine for me. I will try on linux later (I need to re-setup a system). Thinking what else you can try.... Set "loggingLevel" to "Debug" in your .vscode/settings.json, clean the "CMake/Build" output channel, run the "CMake: Set Debug Target" (maybe use the mouse instead of enter? shouldn't matter but let's try) and hopefully something interesting is logged in the output channel when you do this? |
So this morning I set the Output from pressing the `Build` Button
I guess I'll see if the error occurs at some point in the future again. @andreeis thank you for your help ❤️ |
Glad that you are unblocked now. Reactivate this report if this happens again and when you do copy paste the "Debug" logging from the "CMake/Build" ouput channel after you press debug. |
Hi, I had the same issue like you. What's the "Debug Folder" ? I wish it work for me too. Tks. |
@hhx0202, verify that you have a debug target set. Run the command "CMake: Set Debug Target" in the palette and chose which binary you wish to debug (the one launchTargetPath is supposed to point to). Then the commands should work. |
@andreeis My project only has one bin, and I had tried to set the target but it still seemed useless, and every time the drop-down box always let me type the target name(offer no options) and meanwhile in the well-worked project, I can directly choose [all] or [name] as target, and in fact the default [all] works fine for me |
The default "all" is a build target, not a debug target. There are different buttons to select each but sometimes the button to select the debug target is hidden and so I don't confuse you with it I suggested the command "CMake: Set Debug Target" (notice there is also a command "CMake: Set Build Target"). |
Oh I just noticed, your failing project is localized. Maybe you selected the wrong command when translated (or more probably we translated wrong)? I searched for the text "Enter a target name" that I see in your image. That's not invoked when setting the debug target, but when setting the build target. |
Yes, the log says |
It could also be that the in non-working project, you have an older version of CMake (<= 3.7) or |
Instead of building every build type in the same (Maybe I also restarted vscode) |
@FelixBenning oh, I had deleted the build/ folder and re-build but not woked, thanks anyway @andreeis
@bobbrow CMakeLists.txt
|
No idea, everything looks right then. Do you have a repro project that you can easily share? If would be great if we could debug this symptom over here. We can't get into a state where the debug target setting command is broken. |
After a lot of attempt, I finally located the reason: |
I'm glad that you are unblocked. It might not have anything to do with case sensitivity of CMAKE_BUILD_TYPE (unless you explicitly experimented with setting it to "Debug" value and working) but with the generator. You were using "Ninja" or "Visual Studio"? |
On my system, I had the same behavior as you, and it is was being cause by defining CMAKE_BUILD_TYPE. Apparently, some of the tools (CMake? CMake Tools? I don't know) accept "Debug" and not "DEBUG". When checking the CMake Cache, I've found: I've tried some variations: @hhx0202, @bobbrow , @FelixBenning thanks for the info sharing! |
I am facing a similar issue with one of my cmake projects. I am trying to run this on a remote machine. The host machine is OSX 11.4 (Big Sur). The remote is a Ubuntu 20.04.3. The project configures and builds okay. But I am not able to debug any of my unit tests. This is the error I get when I right-click on the test and press 'Debug'
Does not give me any other information. This is what my cmake command looks like:
I have tried Debug, 'Debug', and also 'DEBUG'. Doesn't seem to make a difference. |
@CatsNipYummy I'm going to create a new issue for yours because it does not seem related and this issue is closed. |
Bug
If I use
${command:getLaunchTargetFilename}
in mytask.json
I get the following error:More Detail
This
task.json
has the following output
pressing the build button works without error, and executing
./Debug/.../model_test
manually works as well. (i.e. the file exists!)additionally the
CMakeLists.txt
includesadd_executable(model_test ModelTest.cpp)
.(Possibly) Related Issues
launchTargetPath
inlaunch.json
untilSelect a target to debug
#461[main] Failed to prepare executable target with name 'undefined'
)Platform and Versions
The text was updated successfully, but these errors were encountered: