microsoft / microsoft/vscode-cmake-tools

Missing `XCODE_EMIT_EFFECTIVE_PLATFORM_NAME` support

Open
#3,420 1 comment 0 reactions 0 assignees View on GitHub
bug Feature: debug/launch investigation needed
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

### Brief Issue Summary

*Before reporting the issue, I'd like to say: The VSCode is awesome and thanks for developing the extension!*

The issue will be reproduced when using the following statement in cmake files:

```
set_property(GLOBAL PROPERTY XCODE_EMIT_EFFECTIVE_PLATFORM_NAME ON)
```

Steps to reproduce:
1. Prepare the an empty folder with the following 4 files
2. Open the folder using VSCode on macOS
3. CMake - Configure All Projects
4. Run and Debug - Select `Debug` - Click the play button
5. We will see `launch: program '/tmp/poc/build/xcode/Debug${EFFECTIVE_PLATFORM_NAME}/demo_macos' does not exist`

> $ tree -a
```
.
├── .vscode
│   └── launch.json
├── CMakeLists.txt
├── CMakePresets.json
└── demo.cpp
```

> $ cat .vscode/launch.json
```
{
// https://github.com/microsoft/vscode-cmake-tools/blob/main/docs/debug-launch.md#debug-using-a-launchjson-file
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "cppdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"presentation": {
"hidden": false,
"group": "DebugGroup",
"order": 2
},
"osx": {
"type": "cppdbg",
"MIMode": "lldb",
"setupCommands": [
{
"description": "Enable pretty-printing for lldb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
},
"windows": {
"type": "cppvsdbg",
}
},
]
}
```

> $ cat CMakeLists.txt

```
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.25")
cmake_policy(SET CMP0142 NEW)
set_property(GLOBAL PROPERTY XCODE_EMIT_EFFECTIVE_PLATFORM_NAME ON)
endif()

project(demo)
add_executable(demo_macos demo.cpp)
```

> $ cat CMakePresets.json
```
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 18,
"patch": 0
},
"configurePresets": [
{
"name": "xcode",
"generator": "Xcode",
"binaryDir": "${sourceDir}/build/xcode",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
}
}
],
"buildPresets": [
{
"name": "xcode-Debug",
"displayName": "Debug",
"configurePreset": "xcode",
"configuration": "Debug",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
},
"targets": ["demo_macos"]
}
]
}
```

> $ cat demo.cpp
```
#include

int main (int argc, char *argv[])
{

return 0;
}
```

### CMake Tools Diagnostics

```shell
{
"os": "darwin",
"vscodeVersion": "1.84.0",
"cmtVersion": "1.16.20",
"configurations": [
{
"folder": "/private/tmp/poc",
"cmakeVersion": "3.27.6",
"configured": true,
"generator": "Xcode",
"usesPresets": true,
"compilers": {}
}
],
"cpptoolsIntegration": {
"isReady": true,
"hasCodeModel": true,
"activeBuildType": "Debug",
"buildTypesSeen": [
"Debug",
"Release",
"MinSizeRel",
"RelWithDebInfo"
],
"requests": [
"file:///private/tmp/poc/demo.cpp"
],
"responses": [],
"partialMatches": [
{
"request": "file:///private/tmp/poc/demo.cpp",
"matches": "/tmp/poc/demo.cpp"
}
],
"targetCount": 3,
"executablesCount": 1,
"librariesCount": 0,
"targets": [
{
"name": "ALL_BUILD",
"type": "UTILITY"
},
{
"name": "ZERO_CHECK",
"type": "UTILITY"
},
{
"name": "demo_macos",
"type": "EXECUTABLE"
}
]
},
"settings": [
{
"communicationMode": "automatic",
"useCMakePresets": "auto",
"configureOnOpen": true
}
]
}

```
```

### Debug Log

_No response_

### Additional Information

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the macOS Xcode case using .vscode/launch.json, CMakeLists.txt, CMakePresets.json, and the cmake.launchTargetPath entry point. Trace how the launch target path handles XCODE_EMIT_EFFECTIVE_PLATFORM_NAME and compare it with the generated Debug${EFFECTIVE_PLATFORM_NAME} path. Done means selecting Debug launches demo_macos rather than reporting the unresolved path.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, typescript
Domain
devtools, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.