From 02be5d4fab2f315599aae4d21a61bdaefef366ae Mon Sep 17 00:00:00 2001 From: Aaron Gorodetzky Date: Wed, 22 Jul 2020 05:07:31 -0400 Subject: [PATCH] Create compile_commands.json when building --- .gitignore | 3 ++- CMakeLists.txt | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 61add9b..4df9d13 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ build/ bin/ *.o *.exe -*.so \ No newline at end of file +*.so +compile_commands.json diff --git a/CMakeLists.txt b/CMakeLists.txt index a88c062..1f0e1c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,9 @@ set(CMAKE_C_EXTENSIONS OFF) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +# Export compile commands by default. +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + # Note that testing requires libcheck to be installed on the system! # See the tests/CMakeLists.txt file for details. if(NOT DEFINED BUILD_TESTS) @@ -53,4 +56,3 @@ if(${BUILD_TESTS}) endif(${BUILD_TESTS}) enable_testing() -add_test(NAME check COMMAND check)