From 8a79a3522c2d31bfa1b7c972cbbdd06ac726d14a Mon Sep 17 00:00:00 2001 From: rowanG077 Date: Wed, 7 Jun 2023 17:12:17 +0200 Subject: [PATCH] build: Flatten include dirs when building comp db --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b2e8f006..09eb8187 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,14 @@ include(CheckCXXCompilerFlag) # Allow family.cmake add additional dependencies to gui_${family}. cmake_policy(SET CMP0079 NEW) +# We want to explictly include all include directories when generating the +# compilation database as not all clang/gcc share the same implicit includes +# leading to essentially non-working compile_commands.json +if(CMAKE_EXPORT_COMPILE_COMMANDS) + set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES + ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}) +endif() + # Enable IPO support. cmake_policy(SET CMP0069 NEW) include(CheckIPOSupported)