From 58da85a255b468ad170603e9528d63cf0d73bd27 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Sat, 18 Apr 2020 18:46:04 +0200 Subject: [PATCH] compile-commands: Fix generation of include directories For an unknown reason, multiple set() calls in a row with the same variable override previous attempts to set things, despite using the same variable. This completely breaks generated output as barely any include directories will be set. --- Clang.cmake | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Clang.cmake b/Clang.cmake index 152ef37..982af15 100644 --- a/Clang.cmake +++ b/Clang.cmake @@ -49,23 +49,26 @@ function(string_append_target_includes) (${target_type} STREQUAL "SHARED_LIBRARY") OR (${target_type} STREQUAL "EXECUTABLE") ) + # Include Directories set(prop "$") set(test "$<$:${_ARGS_PREFIX}$>") - set(_out "${_out}${test} ") - set(prop "$") - set(test "$<$:${_ARGS_PREFIX}$>") - set(_out "${_out}${test} ") - set(prop "$") - set(test "$<$:${_ARGS_PREFIX}$>") - set(_out "${_out}${test} ") + set(prop2 "$") + set(test2 "$<$:${_ARGS_PREFIX}$>") + set(prop3 "$") + set(test3 "$<$:${_ARGS_PREFIX}$>") + set(_out "${_out}${test} ${test2} ${test3}") + + # Try and scan any linked libraries for include directories. if(NOT _ARGS_LINKED) - # Scan linked libraries as well. get_target_property(_els ${_target} LINK_LIBRARIES) foreach(_lib ${_els}) - string_append_target_includes(LINKED TARGET "${_lib}" OUTPUT "_out" PREFIX "${_ARGS_PREFIX}") + set(_out2 "") + string_append_target_includes(TARGET "${_lib}" PREFIX "${_ARGS_PREFIX}" OUTPUT _out2 LINKED) + set(_out "${_out}${_out2}") endforeach() endif() elseif((${target_type} STREQUAL "INTERFACE_LIBRARY")) + # Public Include Directories set(prop "$") set(test "$<$:${_ARGS_PREFIX}$>") set(_out "${_out}${test} ")