microsoft / microsoft/vscode-cmake-tools
Cannot build EXCLUDE_FROM_ALL projects correctly
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.7k
- Forks
- 546
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 32
Description
### Brief Issue Summary
cmake-tools cannot generate correct cmake command to build EXECLUDE_FROM_ALL targets.
Steps to reproduce:
--Root CMakeLists.txt:
cmake_minimum_required(VERSION 3.27)
project(Test)
add_subdirectory(ProjA)
add_subdirectory(ProjB EXCLUDE_FROM_ALL)
-- ProjA CMakeLists.txt
cmake_minimum_required(VERSION 3.27)
project(ProjA)
add_executable(${PROJECT_NAME} main.cpp)
--ProjB CMakeLists.txt
cmake_minimum_required(VERSION 3.27)
project(ProjB)
add_executable(${PROJECT_NAME} main.cpp)
set default build target to ProjB and build from vscode:
[build] Starting build
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/Users/seansun/Desktop/Test/build --config Debug --target ProjB -j 10 --
[build] 用于 .NET Framework 的 Microsoft (R) 生成引擎版本 15.9.21+g9802d43bc3
[build] 版权所有(C) Microsoft Corporation。保留所有权利。
[build]
[build] MSBUILD : error MSB1009: 项目文件不存在。(Project file does not exist)
[build] 开关:ProjB.vcxproj
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/Users/seansun/Desktop/Test/build --config Debug --target ProjB -j 10 -- exited with code: 1
[driver] Build completed: 00:00:00.316
[build] Build finished with exit code 1
Actually binary folder in cmake command "c:/Users/seansun/Desktop/Test/build" is not correct as ProjB is not included in target ALL. The path should be "c:/Users/seansun/Desktop/Test/build/ProjB"
CMake version: 3.27
cmake-tools version: 1.16.32
VS version: 2017
vscode version: 1.85.1
Project files are attached for your reference.
thanks.
### CMake Tools Diagnostics
_No response_
### Debug Log
_No response_
### Additional Information
[Test.zip](https://github.com/microsoft/vscode-cmake-tools/files/13683079/Test.zip)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the report with the attached Test.zip and its root, ProjA, and ProjB CMakeLists.txt files, using the documented CMake 3.27 and Visual Studio generator setup. Start by tracing how the build command selects the binary directory for an EXCLUDE_FROM_ALL target. Done means building ProjB from VS Code uses its nested build directory and succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100