[Cmake-commits] CMake branch, next, updated. v2.8.3-767-g7bb92df

Brad King brad.king at kitware.com
Wed Dec 8 13:01:50 EST 2010


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  7bb92dfba067f918e6727be56506d111e8cec4db (commit)
       via  a765c491adc47c05ce0da933c9cb8aae84f5e530 (commit)
      from  36eb4f9fcdac1060fbac68c35900dc2deb2fd6eb (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=7bb92dfba067f918e6727be56506d111e8cec4db
commit 7bb92dfba067f918e6727be56506d111e8cec4db
Merge: 36eb4f9 a765c49
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Dec 8 13:01:48 2010 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Dec 8 13:01:48 2010 -0500

    Merge topic 'imported-target-dependencies' into next
    
    a765c49 Honor custom command dependencies on imported targets (#10395)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a765c491adc47c05ce0da933c9cb8aae84f5e530
commit a765c491adc47c05ce0da933c9cb8aae84f5e530
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Dec 8 12:22:13 2010 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 8 12:22:13 2010 -0500

    Honor custom command dependencies on imported targets (#10395)
    
    Imported targets do not themselves build, but we can follow dependencies
    through them to find real targets.  This allows imported targets to
    depend on custom targets that provide the underlying files at build
    time.

diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index ca61b1f..c82c11e 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1357,8 +1357,8 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep)
     util = cmSystemTools::GetFilenameWithoutLastExtension(util);
     }
 
-  // Check for a non-imported target with this name.
-  if(cmTarget* t = this->GlobalGenerator->FindTarget(0, util.c_str()))
+  // Check for a target with this name.
+  if(cmTarget* t = this->Makefile->FindTargetToUse(util.c_str()))
     {
     // If we find the target and the dep was given as a full path,
     // then make sure it was not a full path to something else, and
@@ -1406,8 +1406,8 @@ cmTargetTraceDependencies
       cit != cc.GetCommandLines().end(); ++cit)
     {
     std::string const& command = *cit->begin();
-    // Look for a non-imported target with this name.
-    if(cmTarget* t = this->GlobalGenerator->FindTarget(0, command.c_str()))
+    // Check for a target with this name.
+    if(cmTarget* t = this->Makefile->FindTargetToUse(command.c_str()))
       {
       if(t->GetType() == cmTarget::EXECUTABLE)
         {
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 0828343..e65e362 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -75,24 +75,64 @@ foreach(c DEBUG RELWITHDEBINFO)
   set_property(TARGET imp_testExe1b PROPERTY COMPILE_DEFINITIONS_${c} EXE_DBG)
 endforeach(c)
 
+#-----------------------------------------------------------------------------
 # Create a custom target to generate a header for the libraries below.
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
+# Drive the header generation through an indirect chain of imported
+# target dependencies.
+
+# testLib2tmp1.h
 add_custom_command(
-  OUTPUT testLib2.h
+  OUTPUT testLib2tmp1.h
   VERBATIM COMMAND
-  ${CMAKE_COMMAND} -E echo "extern int testLib2(void);" > testLib2.h
+    ${CMAKE_COMMAND} -E echo "extern int testLib2(void);" > testLib2tmp1.h
+  )
+
+# hdr_testLib2tmp1 needs testLib2tmp1.h
+add_custom_target(hdr_testLib2tmp1 DEPENDS testLib2tmp1.h)
+
+# exp_testExe2 needs hdr_testLib2tmp1
+add_dependencies(exp_testExe2 hdr_testLib2tmp1)
+
+# testLib2tmp.h needs exp_testExe2
+add_custom_command(
+  OUTPUT testLib2tmp.h
+  VERBATIM COMMAND exp_testExe2
+  COMMAND ${CMAKE_COMMAND} -E copy testLib2tmp1.h testLib2tmp.h
   )
+
+# hdr_testLib2tmp needs testLib2tmp.h
+add_custom_target(hdr_testLib2tmp DEPENDS testLib2tmp.h)
+
+add_library(dep_testLib2tmp UNKNOWN IMPORTED)
+set_property(TARGET dep_testLib2tmp PROPERTY
+  IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/testLib2tmp.h)
+
+# dep_testLib2tmp needs hdr_testLib2tmp
+add_dependencies(dep_testLib2tmp hdr_testLib2tmp)
+
+# testLib2.h needs dep_testLib2tmp
+add_custom_command(
+  OUTPUT testLib2.h
+  VERBATIM COMMAND ${CMAKE_COMMAND} -E copy testLib2tmp.h testLib2.h
+  DEPENDS dep_testLib2tmp
+  )
+
+# hdr_testLib2 needs testLib2.h
 add_custom_target(hdr_testLib2 DEPENDS testLib2.h)
 
-# Drive the header generation through an indirect chain of imported
-# target dependencies.
 add_library(dep_testLib2 UNKNOWN IMPORTED)
+
+# dep_testLib2 needs hdr_testLib2
 add_dependencies(dep_testLib2 hdr_testLib2)
+
+# exp_testLib2 and bld_testLib2 both need dep_testLib2
 add_dependencies(bld_testLib2 dep_testLib2)
 add_dependencies(exp_testLib2 dep_testLib2)
 
+#-----------------------------------------------------------------------------
 # Create a library to be linked by another directory in this project
 # to test transitive linking to otherwise invisible imported targets.
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
 add_library(imp_lib1 STATIC imp_lib1.c)
 target_link_libraries(imp_lib1 exp_testLib2)
 add_library(imp_lib1b STATIC imp_lib1.c)

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

Summary of changes:
 Source/cmTarget.cxx                        |    8 ++--
 Tests/ExportImport/Import/A/CMakeLists.txt |   50 +++++++++++++++++++++++++---
 2 files changed, 49 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list