Skip to content

Instantly share code, notes, and snippets.

@fasheng
Created October 29, 2013 01:58
Show Gist options
  • Save fasheng/7208018 to your computer and use it in GitHub Desktop.
Save fasheng/7208018 to your computer and use it in GitHub Desktop.
Add semantic system include DIR through pkg-config. Usage: (fsh-semantic-pkg-config "gtk+-2.0 webkit-1.0..." 'c-mode)
(defun fsh-semantic-pkg-config (libs mode)
"Add semantic system include DIR through pkg-config.
Usage: (fsh-semantic-pkg-config \"gtk+-2.0 QtGui QtNetwork...\" 'c-mode)"
(let* ((pkg-cmd "pkg-config")
(pkg-opt (format "--cflags %s" libs)))
(setq result (shell-command-to-string (format "%s %s" pkg-cmd pkg-opt)))
(dolist (str (split-string result))
(if (string-match-p "^-I" str)
(semantic-add-system-include (substring str 2 nil) mode)
))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment