Sublime Text Generator sets incorrect directory paths for build tree
Expected behaviour
Sublime Text GNU Makefile generator uses the correct path to build a CMake project.
Current behaviour
Sublime Text GNU Makefile generator does not use the correct path to build the targets, when the project is not build from CMake root build directory and the targets are defined in a sub directory.
Steps to replicate
- Create a CMake project
CMakeLists.txt
cmake_minimum_required( VERSION 3.16 )
project(p1 LANGUAGES NONE)
add_custom_target(t1)
add_subdirectory(src)
src/CMakeLists.txt
project(p2 LANGUAGES NONE)
add_custom_target(t2)
- Configure the project
cmake -S . -B build -G "Sublime Text 2 - Unix Makefiles"
- Open
/build/src/2.sublime-project
p2.sublime-project
{
"folders":
[
{
"path": "../"
}
],
"build_systems":
[
{
"name": "p2 - t2",
"cmd": ["/usr/bin/gmake", "-f", "Makefile", "t2"],
"working_dir": "${project_path}",
"file_regex": "^(..[^:]*)(?::|\\()([0-9]+)(?::|\\))(?:([0-9]+):)?\\s*(.*)"
}
]
}
- above only shows the relevant parts from the file content
- note the "path" value, which should be
"path": "."
to point to the build tree - note the path to the source tree is missing
- note the "working_dir" value, which should be
"${project_path}/src"
- note the "path" value, which should be