From 01bd0808849085903a13356ed7470a0e6b3a257a Mon Sep 17 00:00:00 2001 From: Marcin Kacprzak Date: Tue, 19 Sep 2023 06:47:40 +0200 Subject: [PATCH] Follow includes in CMake files (#1842) --- projectile.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/projectile.el b/projectile.el index d2cfb5c8b..d6c6c24f5 100644 --- a/projectile.el +++ b/projectile.el @@ -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