target_*: Fix cross-directory call backtraces

Record the call-site backtrace, not the current backtrace of the
target's directory.

Fixes: #23873
This commit is contained in:
Brad King
2022-08-22 10:58:46 -04:00
parent 0d64c3abd1
commit 52c95540b7
11 changed files with 67 additions and 76 deletions
+3 -1
View File
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmTargetCompileDefinitionsCommand.h"
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmStringAlgorithms.h"
@@ -28,7 +29,8 @@ private:
const std::vector<std::string>& content,
bool /*prepend*/, bool /*system*/) override
{
tgt->AppendProperty("COMPILE_DEFINITIONS", this->Join(content));
tgt->AppendProperty("COMPILE_DEFINITIONS", this->Join(content),
this->Makefile->GetBacktrace());
return true; // Successfully handled.
}