[Cmake-commits] CMake branch, next, updated. v3.3.0-rc2-656-g11836f6

Brad King brad.king at kitware.com
Thu Jun 25 09:35:10 EDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  11836f68df2a2370f87b3a11a743148bd2a6949a (commit)
       via  30c2e1dd16e061fbabffa35816cb893d81ff0dcf (commit)
      from  704fbe08de5af1aa788282e1e7f6933d09b49fb7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=11836f68df2a2370f87b3a11a743148bd2a6949a
commit 11836f68df2a2370f87b3a11a743148bd2a6949a
Merge: 704fbe0 30c2e1d
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jun 25 09:35:09 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Jun 25 09:35:09 2015 -0400

    Merge topic 'fix-target_link_libraries-wrong-dir' into next
    
    30c2e1dd cmTarget: Fix diagnostic of target_link_libraries in wrong directory (#15626)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=30c2e1dd16e061fbabffa35816cb893d81ff0dcf
commit 30c2e1dd16e061fbabffa35816cb893d81ff0dcf
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Jun 23 14:56:47 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jun 25 09:14:26 2015 -0400

    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.

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));
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 2150b83..3eb9e7e 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 df37d66..b57b921 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 f97022e..533c6a1 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 0000000..d00491f
--- /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 0000000..5cd1f23
--- /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 0000000..32431ce
--- /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 0000000..b0b2380
--- /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 0000000..e69de29

-----------------------------------------------------------------------

Summary of changes:
 Source/cmTarget.cxx                                               |    4 ++--
 Source/cmTarget.h                                                 |    3 ++-
 Source/cmTargetLinkLibrariesCommand.cxx                           |    3 ++-
 Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake           |    1 +
 .../SubDirTarget-result.txt}                                      |    0
 Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt      |    5 +++++
 Tests/RunCMake/target_link_libraries/SubDirTarget.cmake           |    3 +++
 Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt  |    1 +
 .../{GeneratorExpression => target_link_libraries}/empty.c        |    0
 9 files changed, 16 insertions(+), 4 deletions(-)
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => target_link_libraries/SubDirTarget-result.txt} (100%)
 create mode 100644 Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt
 create mode 100644 Tests/RunCMake/target_link_libraries/SubDirTarget.cmake
 create mode 100644 Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt
 copy Tests/RunCMake/{GeneratorExpression => target_link_libraries}/empty.c (100%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list