Skip to content

Commit

Permalink
Follow includes in CMake files (#1842)
Browse files Browse the repository at this point in the history
  • Loading branch information
kacprzak authored Sep 19, 2023
1 parent eaf2644 commit 01bd080
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion projectile.el
Original file line number Diff line number Diff line change
Expand Up @@ -3089,13 +3089,24 @@ it acts on the current project."
"Map from COMMAND-TYPE to id of command preset array in CMake preset."
(cdr (assoc command-type projectile--cmake-command-preset-array-id-alist)))

(defun projectile--cmake-command-presets (filename command-type)
(defun projectile--cmake-command-presets-shallow (filename command-type)
"Get CMake COMMAND-TYPE presets from FILENAME."
(when-let ((preset (projectile--cmake-read-preset (projectile-expand-root filename))))
(cl-remove-if
(lambda (preset) (equal (gethash "hidden" preset) t))
(gethash (projectile--cmake-command-preset-array-id command-type) preset))))

(defun projectile--cmake-command-presets (filename command-type)
"Get CMake COMMAND-TYPE presets from FILENAME. Follows included files"
(when-let ((preset (projectile--cmake-read-preset (projectile-expand-root filename))))
(append
(projectile--cmake-command-presets-shallow filename command-type)
(mapcar
(lambda (included-file) (projectile--cmake-command-presets
(expand-file-name included-file (file-name-directory filename))
command-type))
(gethash "include" preset)))))

(defun projectile--cmake-all-command-presets (command-type)
"Get CMake user and system COMMAND-TYPE presets."
(projectile-flatten
Expand Down

0 comments on commit 01bd080

Please sign in to comment.