summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-06-25 10:11:50 -0400
committerBrad King <brad.king@kitware.com>2015-06-25 10:11:50 -0400
commite4a9346dba41252f0f806b33cb026095e03fb00c (patch)
tree337dc07ee2041e3a036817d9f847723e92bdaed3
parent9e5e645ae6081f8c29ef00144f85d69a64d361a0 (diff)
parent30c2e1dd16e061fbabffa35816cb893d81ff0dcf (diff)
downloadcmake-e4a9346dba41252f0f806b33cb026095e03fb00c.tar.gz
Merge branch 'fix-target_link_libraries-wrong-dir' into release
-rw-r--r--Source/cmTarget.cxx4
-rw-r--r--Source/cmTarget.h3
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx3
-rw-r--r--Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt5
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget.cmake3
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/empty.c0
9 files changed, 17 insertions, 4 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 70005b4fa0..4def889056 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));
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 2150b8342f..3eb9e7ec93 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -207,7 +207,8 @@ public:
KeywordTLLSignature,
PlainTLLSignature
};
- bool PushTLLCommandTrace(TLLSignature signature);
+ bool PushTLLCommandTrace(TLLSignature signature,
+ cmListFileContext const& lfc);
void GetTllSignatureTraces(std::ostringstream &s, TLLSignature sig) const;
void MergeLinkLibraries( cmMakefile& mf, const std::string& selfname,
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index df37d66063..b57b921cf2 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -368,7 +368,8 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
|| this->CurrentProcessingState == ProcessingKeywordPublicInterface
|| this->CurrentProcessingState == ProcessingKeywordLinkInterface)
? cmTarget::KeywordTLLSignature : cmTarget::PlainTLLSignature;
- if (!this->Target->PushTLLCommandTrace(sig))
+ if (!this->Target->PushTLLCommandTrace(
+ sig, this->Makefile->GetExecutionContext()))
{
std::ostringstream e;
const char *modal = 0;
diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
index f97022e1b4..533c6a15eb 100644
--- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
+++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
@@ -6,3 +6,4 @@ run_cmake(CMP0023-WARN-2)
run_cmake(CMP0023-NEW-2)
run_cmake(MixedSignature)
run_cmake(Separate-PRIVATE-LINK_PRIVATE-uses)
+run_cmake(SubDirTarget)
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt
new file mode 100644
index 0000000000..5cd1f23d7b
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at SubDirTarget.cmake:[0-9]+ \(target_link_libraries\):
+ Attempt to add link library "m" to target "subexe" which is not built in
+ this directory.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake b/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake
new file mode 100644
index 0000000000..32431cecc0
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake
@@ -0,0 +1,3 @@
+enable_language(C)
+add_subdirectory(SubDirTarget)
+target_link_libraries(subexe m)
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt
new file mode 100644
index 0000000000..b0b23809a6
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt
@@ -0,0 +1 @@
+add_executable(subexe ../empty.c)
diff --git a/Tests/RunCMake/target_link_libraries/empty.c b/Tests/RunCMake/target_link_libraries/empty.c
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/empty.c