aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Schmitz <johannes.schmitz1@gmail.com>2019-04-26 21:52:23 +0200
committerAndrej Rode <mail@andrejro.de>2019-05-11 21:30:49 +0200
commitc89f0d595b948488d72f00e3bcaa0503ec22b636 (patch)
treeee3592dee0a0483d8a97c1c695730e9ccf816a65
parentblocks/grc: fix null_source C++ generation (diff)
downloadgnuradio-c89f0d595b948488d72f00e3bcaa0503ec22b636.tar.xz
gnuradio-c89f0d595b948488d72f00e3bcaa0503ec22b636.zip
cmake: Enable CMAKE_EXPORT_COMPILE_COMMANDS
When CMAKE_EXPORT_COMPILE_COMMANDS is ON, a file compile_commands.json will be created in the build directory that enables code completion engines to find all include directories and provide a very comprehensive auto completion experience without any manual IDE configuration. A nice example for this is the VS Code extension cpptools that is developed by Microsoft. Of course this is not limited to VS Code and works with other engines such as YouCompleteMe as well.
-rw-r--r--CMakeLists.txt3
-rw-r--r--gr-utils/python/modtool/templates/gr-newmod/CMakeLists.txt3
2 files changed, 6 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b29909c57..635af100d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -65,6 +65,9 @@ set(CLANG_MIN_VERSION "3.4.0")
set(APPLECLANG_MIN_VERSION "500")
set(MSVC_MIN_VERSION "1800")
+# Enable generation of compile_commands.json for code completion engines
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
########################################################################
# Configure CMake policies
########################################################################
diff --git a/gr-utils/python/modtool/templates/gr-newmod/CMakeLists.txt b/gr-utils/python/modtool/templates/gr-newmod/CMakeLists.txt
index ea8eb3fb8..0f603b48b 100644
--- a/gr-utils/python/modtool/templates/gr-newmod/CMakeLists.txt
+++ b/gr-utils/python/modtool/templates/gr-newmod/CMakeLists.txt
@@ -49,6 +49,9 @@ set(VERSION_INFO_MAINT_VERSION git)
cmake_policy(SET CMP0011 NEW)
+# Enable generation of compile_commands.json for code completion engines
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
########################################################################
# Compiler specific setup
########################################################################