Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions cpputils-cmake.el
Original file line number Diff line number Diff line change
Expand Up @@ -414,16 +414,21 @@ White space here is any of: space, tab, emacs newline (line feed, ASCII 10)."
)
))

(defun cppcm-create-compilation-command (target-path)
"Create command for compilation. By default returns 'make -C <target-path>.'
You can replace the function to use another command."
(concat "make -C " target-path))

(defun cppcm-compile-in-current-exe-dir ()
"compile the executable/library in current directory."
(interactive)
(setq compile-command (concat "make -C " (cppcm-get-exe-dir-path-current-buffer)))
(setq compile-command (cppcm-create-compilation-command (cppcm-get-exe-dir-path-current-buffer)))
(call-interactively 'compile))

(defun cppcm-compile-in-root-build-dir ()
"compile in build directory"
(interactive)
(setq compile-command (concat "make -C " cppcm-build-dir))
(setq compile-command (cppcm-create-compilation-command cppcm-build-dir))
(call-interactively 'compile))

;;;###autoload
Expand Down Expand Up @@ -499,7 +504,7 @@ by customize `cppcm-compile-list'."
(dolist (x inc-dirs) (add-to-list 'cc-search-directories x))
))))
(when (and cppcm-build-dir (file-exists-p (concat cppcm-build-dir "CMakeCache.txt")))
(setq compile-command (concat "make -C " cppcm-build-dir))
(setq compile-command (cppcm-create-compilation-command cppcm-build-dir))
)
(run-hook-with-args 'cppcm-reload-all-hook)
)
Expand Down