question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cmake.getLaunchTargetFilename is broken

See original GitHub issue

Bug

If I use ${command:getLaunchTargetFilename} in my task.json I get the following error:

[main] =======================================================
[main] No executable target was found to launch. Please check:
[main]  - Have you called add_executable() in your CMake project?
[main]  - Have you executed a successful CMake configure?
[main] No program will be executed

More Detail

This task.json

{
	// See https://go.microsoft.com/fwlink/?LinkId=733558
	// for the documentation about the tasks.json format
	"version": "2.0.0",
	"tasks": [
		{
			"label": "echo",
			"type": "shell",
			"command": "echo 'buildTargetName: ${command:cmake.buildTargetName}\nbuildType: ${command:cmake.buildType}\ntasksBuildCommand: ${command:cmake.tasksBuildCommand}\nbuildDirectory: ${command:cmake.buildDirectory}\n'"
		}
	]
}

has the following output

buildTargetName: model_test
buildType: Debug
tasksBuildCommand: /usr/bin/cmake --build /home/fbenning/code/grazer/Debug --config Debug --target model_test -- -j 10
buildDirectory: /home/fbenning/code/grazer/Debug

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 includes add_executable(model_test ModelTest.cpp).

(Possibly) Related Issues

Platform and Versions

  • Operating System: Ubuntu
  • CMake Version: 3.16.3
  • VSCode Version:1.53.2
  • CMake Tools Extension Version:1.6.0
  • Compiler/Toolchain: GCC 9.3.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:23 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
hhx0202commented, Mar 5, 2021

After a lot of attempt, I finally located the reason: In CMakeLists.txt, I wrote set(CMAKE_BUILD_TYPE DEBUG) for my project, maybe this command disturbed the parsing of CMakeCache.txt for cmake-tools? after annotating the line and rebuilding, everything worked normally : ) and I realized CMAKE_BUILD_TYPE possible value should be Debug instead of DEBUG…but it looks like DEBUG is acceptable for cmake as I can use gdb with my bin…well @andreeis @FelixBenning thank you for your help

0reactions
bobbrowcommented, Aug 25, 2021

@CatsNipYummy I’m going to create a new issue for yours because it does not seem related and this issue is closed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio Code with CMake Tools: launch.json not ...
I am trying to configure VSCode for debugging my code. My project is configured by CMake. I use the CMake Tools extensions.
Read more >
"Fossies" - the Fresh Open Source Software Archive
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting...
Read more >
vscode-cmake-tools/support - Gitter
The message I'm getting is: [main] No executable target was found to launch. Please check: [main] - Have you called add_executable() in your...
Read more >
CMake: IntelliSense not working for newly added .cpp files
1. Open a new CMake project and wait for CMake and Visual Studio to complete. · 2. Add a new source file to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found