Skip to content

Commit

Permalink
CMake: make sure compile_commands.json is readable by ccls
Browse files Browse the repository at this point in the history
  • Loading branch information
bk138 committed Apr 25, 2020
1 parent fbda8bd commit ffe9682
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ project(gromit-mpx LANGUAGES C)
set(target_name gromit-mpx)
set(version 1.3)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if(CMAKE_GENERATOR MATCHES "Unix Makefiles|Ninja")
# some LSP servers expect compile_commands.json in the project root
add_custom_target(
copy-compile-commands ALL
${CMAKE_COMMAND} -E copy_if_different
${CMAKE_BINARY_DIR}/compile_commands.json
${CMAKE_CURRENT_SOURCE_DIR}
)
endif(CMAKE_GENERATOR MATCHES "Unix Makefiles|Ninja")

set(CMAKE_C_FLAGS " ${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter")

Expand Down

0 comments on commit ffe9682

Please sign in to comment.