I want to setup lsp-cmake lsp server in my vanilla emacs.

I just installed lsp server using pip install cmake-language-server.

I don't know how to configure in my emacs init.el to use the lsp server. The couldn't find any documentation as well for emacs.

How can I configure lsp-cmake in my init file for emacs

1 Answer 1


You can try something like the following.

(use-package lsp-mode
  :ensure t)

(use-package cmake-mode
  :ensure t
  :mode ("CMakeLists\\.txt\\'" "\\.cmake\\'")
  :hook (cmake-mode . lsp-deferred))

(use-package cmake-font-lock
  :ensure t
  :after cmake-mode
  :config (cmake-font-lock-activate))

The lsp-mode package provides additional features like integration with which-key, showing diagnostics and breadcrumbs, which you may want to explore if they are important for you with cmake-mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.