File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments