Generate the compilation database through CMake

Use an Emacs directory-local variable to specify to ccls where the compilation
directory lives, tell CMake to generate the compilation database, and remove
bear from the environment.

Add clang to the environment for clang-format.
This commit is contained in:
Tom Willemse 2021-07-22 01:09:45 -07:00
parent 50473e5ab5
commit 79c1056553
Signed by: ryuslash
GPG key ID: 7D5C407B435025C1
3 changed files with 8 additions and 1 deletions

4
.dir-locals.el Normal file
View file

@ -0,0 +1,4 @@
;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")
((c-mode . ((ccls-args . '("--init={\"compilationDatabaseDirectory\": \"clox/_build\"}")))))

View file

@ -2,4 +2,6 @@ cmake_minimum_required(VERSION 2.19)
project(Lox C) project(Lox C)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_subdirectory(src) add_subdirectory(src)

View file

@ -9,4 +9,5 @@
(specification->package "dejagnu") (specification->package "dejagnu")
(specification->package "gcc-toolchain") (specification->package "gcc-toolchain")
(specification->package "ccls") (specification->package "ccls")
(specification->package "bear"))) ;; For clang-format
(specification->package "clang")))