Skip to content

Commit

Permalink
Add support for preset-based installs in CMake projects.
Browse files Browse the repository at this point in the history
  • Loading branch information
jehelset authored and bbatsov committed Feb 8, 2022
1 parent 90da545 commit 474cd42
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* [#1699](https://github.com/bbatsov/projectile/pull/1699): `projectile-ripgrep` now supports [`rg.el`](https://github.com/dajva/rg.el).
* [#1712](https://github.com/bbatsov/projectile/issues/1712): Make it possible to hide Projectile's menu. See `projectile-show-menu`.
* [#1718](https://github.com/bbatsov/projectile/issues/1718): Add a project type definition for `GNUMakefile`.
* [#1747](https://github.com/bbatsov/projectile/pull/1747): Add support for preset-based install-commands for CMake projects.

### Bugs fixed

Expand Down
12 changes: 9 additions & 3 deletions projectile.el
Original file line number Diff line number Diff line change
Expand Up @@ -2916,7 +2916,8 @@ select a name of a command preset, or opt a manual command by selecting
(defconst projectile--cmake-manual-command-alist
'((:configure-command . "cmake -S . -B build")
(:compile-command . "cmake --build build")
(:test-command . "cmake --build build --target test")))
(:test-command . "cmake --build build --target test")
(:install-command . "cmake --build build --target install")))

(defun projectile--cmake-manual-command (command-type)
"Create maunual CMake COMMAND-TYPE command."
Expand All @@ -2925,7 +2926,8 @@ select a name of a command preset, or opt a manual command by selecting
(defconst projectile--cmake-preset-command-alist
'((:configure-command . "cmake . --preset %s")
(:compile-command . "cmake --build --preset %s")
(:test-command . "ctest --preset %s")))
(:test-command . "ctest --preset %s")
(:install-command . "cmake --build --preset %s --target install")))

(defun projectile--cmake-preset-command (command-type preset)
"Create CMake COMMAND-TYPE command using PRESET."
Expand Down Expand Up @@ -2959,6 +2961,10 @@ a manual COMMAND-TYPE command is created with
"CMake test command."
(projectile--cmake-command :test-command))

(defun projectile--cmake-install-command ()
"CMake install command."
(projectile--cmake-command :install-command))

;;; Project type registration
;;
;; Project type detection happens in a reverse order with respect to
Expand Down Expand Up @@ -3032,7 +3038,7 @@ a manual COMMAND-TYPE command is created with
:configure #'projectile--cmake-configure-command
:compile #'projectile--cmake-compile-command
:test #'projectile--cmake-test-command
:install "cmake --build build --target install"
:install #'projectile--cmake-install-command
:package "cmake --build build --target package")
;; PHP
(projectile-register-project-type 'php-symfony '("composer.json" "app" "src" "vendor")
Expand Down

0 comments on commit 474cd42

Please sign in to comment.