Skip to content

Commit 004c920

Browse files
committed
Merge remote-tracking branch 'upstream/development' into development
2 parents 11a432b + 04636b0 commit 004c920

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

cppython/plugins/cmake/plugin.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,29 @@ def list_targets(self) -> list[str]:
208208

209209
return sorted(targets)
210210

211+
def list_targets(self) -> list[str]:
212+
"""Lists discovered build targets/executables in the CMake build directory.
213+
214+
Searches the build directory for executable files, excluding common
215+
non-target files.
216+
217+
Returns:
218+
A sorted list of unique target names found.
219+
"""
220+
build_path = self.core_data.cppython_data.build_path
221+
222+
if not build_path.exists():
223+
return []
224+
225+
# Collect executable files from the build directory
226+
targets: set[str] = set()
227+
for candidate in build_path.rglob('*'):
228+
if candidate.is_file() and (candidate.stat().st_mode & 0o111 or candidate.suffix == '.exe'):
229+
# Use the stem (name without extension) as the target name
230+
targets.add(candidate.stem)
231+
232+
return sorted(targets)
233+
211234
def plugin_info(self) -> PluginReport:
212235
"""Return a report describing the CMake generator's configuration and managed files.
213236

0 commit comments

Comments
 (0)