diff options
author | Brad King <brad.king@kitware.com> | 2015-06-23 18:56:47 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-06-25 13:14:26 (GMT) |
commit | 30c2e1dd16e061fbabffa35816cb893d81ff0dcf (patch) | |
tree | e4409727504fc359fe48c8509601fc124277e371 /Source/cmTarget.cxx | |
parent | a6916a6c6e397bda8b381f65dbfc59d3c52f8525 (diff) | |
download | CMake-30c2e1dd16e061fbabffa35816cb893d81ff0dcf.zip CMake-30c2e1dd16e061fbabffa35816cb893d81ff0dcf.tar.gz CMake-30c2e1dd16e061fbabffa35816cb893d81ff0dcf.tar.bz2 |
cmTarget: Fix diagnostic of target_link_libraries in wrong directory (#15626)
Since commit v3.3.0-rc1~62^2~5 (cmTarget: Store only cmListFileContext
for CMP0023 handling, 2015-05-18) a call to target_link_libraries on a
target that was defined in another (non-ancestor) directory crashes
because no execution context is left active. Fix this by getting the
execution context from the actual cmMakefile where the current
target_link_libraries call takes place. Test this by verifying that
such calls correctly produce an error diagnostic instead of crashing.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 70005b4..4def889 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1231,7 +1231,8 @@ static std::string targetNameGenex(const std::string& lib) } //---------------------------------------------------------------------------- -bool cmTarget::PushTLLCommandTrace(TLLSignature signature) +bool cmTarget::PushTLLCommandTrace(TLLSignature signature, + cmListFileContext const& lfc) { bool ret = true; if (!this->TLLCommands.empty()) @@ -1241,7 +1242,6 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature) ret = false; } } - cmListFileContext lfc = this->Makefile->GetExecutionContext(); if (this->TLLCommands.empty() || this->TLLCommands.back().second != lfc) { this->TLLCommands.push_back(std::make_pair(signature, lfc)); |