🆕 [CMake] Enable generation of compile_commands.json

Problem:
- `compile_commands.json` is not being generated, which hurts editor
  integration with tooling.

Solution:
- Generate the `compile_commands.json` file with CMake, if the CMake
  version is sufficient.
This commit is contained in:
Jonathan Gopel 2020-10-27 21:30:59 -06:00
parent cb224ecaa3
commit 49cb790b9f

View File

@ -5,6 +5,11 @@ if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
# Enable generation of compile_commands.json if the CMake version is high enough
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.5)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
endif()
# Determine if fmt is built as a subproject (using add_subdirectory)
# or if it is the master project.
set(MASTER_PROJECT OFF)