[Cmake-commits] CMake branch, next, updated. v2.8.3-545-g103a6ce

Brad King brad.king at kitware.com
Fri Nov 5 09:20:10 EDT 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  103a6ce0a0ff91ba760c0b4e847b98104ba3b77e (commit)
       via  95f149e61f1ad8c8cadd74f2dbe36a2613815cc2 (commit)
       via  07cfa57ec5f9f906e075512646100719a0a615aa (commit)
      from  c12ea6d54a09c1c87ee36a17ec02c55bfbee2277 (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=103a6ce0a0ff91ba760c0b4e847b98104ba3b77e
commit 103a6ce0a0ff91ba760c0b4e847b98104ba3b77e
Merge: c12ea6d 95f149e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Nov 5 09:20:08 2010 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Nov 5 09:20:08 2010 -0400

    Merge topic 'external-link-depends' into next
    
    95f149e Define LINK_DEPENDS target property (#11406)
    07cfa57 Consolidate duplicate link rule make dependency code


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=95f149e61f1ad8c8cadd74f2dbe36a2613815cc2
commit 95f149e61f1ad8c8cadd74f2dbe36a2613815cc2
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Nov 5 09:05:08 2010 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Nov 5 09:05:08 2010 -0400

    Define LINK_DEPENDS target property (#11406)
    
    Custom Makefile link rules may need to depend on linker scripts.  Define
    this property to allow user-specified link-time dependencies.

diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 0c150df..9153f3a 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1534,6 +1534,13 @@ void cmMakefileTargetGenerator
     {
     depends.push_back(*obj);
     }
+
+  // Add user-specified dependencies.
+  if(const char* linkDepends =
+     this->Target->GetProperty("LINK_DEPENDS"))
+    {
+    cmSystemTools::ExpandListArgument(linkDepends, depends);
+    }
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 5380257..ca61b1f 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -532,6 +532,18 @@ void cmTarget::DefineProperties(cmake *cm)
      "configurations explicitly.");
 
   cm->DefineProperty
+    ("LINK_DEPENDS", cmProperty::TARGET,
+     "Additional files on which a target binary depends for linking.",
+     "Specifies a semicolon-separated list of full-paths to files on which "
+     "the link rule for this target depends.  "
+     "The target binary will be linked if any of the named files is newer "
+     "than it."
+     "\n"
+     "This property is ignored by non-Makefile generators.  "
+     "It is intended to specify dependencies on \"linker scripts\" for "
+     "custom Makefile link rules.");
+
+  cm->DefineProperty
     ("LINK_INTERFACE_LIBRARIES", cmProperty::TARGET,
      "List public interface libraries for a shared library or executable.",
      "By default linking to a shared library target transitively "
diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt
index 8714640..31392b5 100644
--- a/Tests/BuildDepends/CMakeLists.txt
+++ b/Tests/BuildDepends/CMakeLists.txt
@@ -34,6 +34,12 @@ if(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel")
   set(_cmake_options "-DCMAKE_EXE_LINKER_FLAGS=")
 endif()
 
+if("${CMAKE_GENERATOR}" MATCHES "Make")
+  set(TEST_LINK_DEPENDS ${BuildDepends_BINARY_DIR}/Project/linkdep.txt)
+  file(WRITE ${TEST_LINK_DEPENDS} "1")
+endif()
+list(APPEND _cmake_options "-DTEST_LINK_DEPENDS=${TEST_LINK_DEPENDS}")
+
 file(MAKE_DIRECTORY ${BuildDepends_BINARY_DIR}/Project)
 message("Creating Project/foo.cxx")
 write_file(${BuildDepends_BINARY_DIR}/Project/foo.cxx 
@@ -131,6 +137,10 @@ file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot_macro_dir.hxx
 file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot_macro_tgt.hxx
   "static const char* zot_macro_tgt = \"zot_macro_tgt changed\";\n")
 
+if(TEST_LINK_DEPENDS)
+  file(WRITE ${TEST_LINK_DEPENDS} "2")
+endif()
+
 help_xcode_depends()
 
 message("Building project second time")
@@ -194,3 +204,16 @@ if("${out}" STREQUAL "${VALUE_CHANGED}")
 else("${out}" STREQUAL "${VALUE_CHANGED}")
   message(SEND_ERROR "Project did not rebuild properly!")
 endif("${out}" STREQUAL "${VALUE_CHANGED}")
+
+if(TEST_LINK_DEPENDS)
+  set(linkdep ${BuildDepends_BINARY_DIR}/Project/linkdep${CMAKE_EXECUTABLE_SUFFIX})
+  if(${linkdep} IS_NEWER_THAN ${TEST_LINK_DEPENDS})
+    message("LINK_DEPENDS worked")
+  else()
+    message(SEND_ERROR "LINK_DEPENDS failed.  Executable
+  ${linkdep}
+is not newer than dependency
+  ${TEST_LINK_DEPENDS}
+")
+  endif()
+endif()
diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt
index e9d1296..70a2f37 100644
--- a/Tests/BuildDepends/Project/CMakeLists.txt
+++ b/Tests/BuildDepends/Project/CMakeLists.txt
@@ -80,3 +80,8 @@ set_property(
   DIRECTORY
   PROPERTY IMPLICIT_DEPENDS_INCLUDE_TRANSFORM "ZOT_DIR(%)=<zot_%_dir.hxx>"
   )
+
+if(TEST_LINK_DEPENDS)
+  add_executable(linkdep linkdep.cxx)
+  set_property(TARGET linkdep PROPERTY LINK_DEPENDS ${TEST_LINK_DEPENDS})
+endif()
diff --git a/Tests/BuildDepends/Project/linkdep.cxx b/Tests/BuildDepends/Project/linkdep.cxx
new file mode 100644
index 0000000..f8b643a
--- /dev/null
+++ b/Tests/BuildDepends/Project/linkdep.cxx
@@ -0,0 +1,4 @@
+int main()
+{
+  return 0;
+}

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=07cfa57ec5f9f906e075512646100719a0a615aa
commit 07cfa57ec5f9f906e075512646100719a0a615aa
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Nov 5 08:33:47 2010 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Nov 5 08:33:47 2010 -0400

    Consolidate duplicate link rule make dependency code
    
    Factor code previously duplicated for library and executable rules into
    a common method.

diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index a5e319d..4426241 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -82,34 +82,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
 {
   std::vector<std::string> commands;
 
-  std::string relPath = this->LocalGenerator->GetHomeRelativeOutputPath();
-  std::string objTarget;
-
   // Build list of dependencies.
   std::vector<std::string> depends;
-  for(std::vector<std::string>::const_iterator obj = this->Objects.begin();
-      obj != this->Objects.end(); ++obj)
-    {
-    objTarget = relPath;
-    objTarget += *obj;
-    depends.push_back(objTarget);
-    }
-
-  // Add dependencies on targets that must be built first.
-  this->AppendTargetDepends(depends);
-
-  // Add a dependency on the rule file itself.
-  this->LocalGenerator->AppendRuleDepend(depends,
-                                         this->BuildFileNameFull.c_str());
-
-  for(std::vector<std::string>::const_iterator obj =
-        this->ExternalObjects.begin();
-      obj != this->ExternalObjects.end(); ++obj)
-    {
-    depends.push_back(*obj);
-    }
-
-  // from here up is the same for exe or lib
+  this->AppendLinkDepends(depends);
 
   // Get the name of the executable to generate.
   std::string targetName;
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index dff91fe..049a338 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -308,33 +308,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
   // code duplication.
   std::vector<std::string> commands;
 
-  std::string relPath = this->LocalGenerator->GetHomeRelativeOutputPath();
-  std::string objTarget;
-
   // Build list of dependencies.
   std::vector<std::string> depends;
-  for(std::vector<std::string>::const_iterator obj = this->Objects.begin();
-      obj != this->Objects.end(); ++obj)
-    {
-    objTarget = relPath;
-    objTarget += *obj;
-    depends.push_back(objTarget);
-    }
+  this->AppendLinkDepends(depends);
 
-  // Add dependencies on targets that must be built first.
-  this->AppendTargetDepends(depends);
-
-  // Add a dependency on the rule file itself.
-  this->LocalGenerator->AppendRuleDepend(depends, 
-                                         this->BuildFileNameFull.c_str());
-  
-  for(std::vector<std::string>::const_iterator obj 
-        = this->ExternalObjects.begin();
-      obj != this->ExternalObjects.end(); ++obj)
-    {
-    depends.push_back(*obj);
-    }
-  
   // Get the language to use for linking this library.
   const char* linkLanguage =
     this->Target->GetLinkerLanguage(this->ConfigName);
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index d5d6585..0c150df 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1507,6 +1507,37 @@ void cmMakefileTargetGenerator
 
 //----------------------------------------------------------------------------
 void cmMakefileTargetGenerator
+::AppendLinkDepends(std::vector<std::string>& depends)
+{
+  // Add dependencies on the compiled object files.
+  std::string relPath = this->LocalGenerator->GetHomeRelativeOutputPath();
+  std::string objTarget;
+  for(std::vector<std::string>::const_iterator obj = this->Objects.begin();
+      obj != this->Objects.end(); ++obj)
+    {
+    objTarget = relPath;
+    objTarget += *obj;
+    depends.push_back(objTarget);
+    }
+
+  // Add dependencies on targets that must be built first.
+  this->AppendTargetDepends(depends);
+
+  // Add a dependency on the rule file itself.
+  this->LocalGenerator->AppendRuleDepend(depends,
+                                         this->BuildFileNameFull.c_str());
+
+  // Add dependencies on the external object files.
+  for(std::vector<std::string>::const_iterator obj
+        = this->ExternalObjects.begin();
+      obj != this->ExternalObjects.end(); ++obj)
+    {
+    depends.push_back(*obj);
+    }
+}
+
+//----------------------------------------------------------------------------
+void cmMakefileTargetGenerator
 ::CloseFileStreams()
 {
   delete this->BuildFileStream;
diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h
index 4ee2b39..c9aede2 100644
--- a/Source/cmMakefileTargetGenerator.h
+++ b/Source/cmMakefileTargetGenerator.h
@@ -115,6 +115,9 @@ protected:
   // append intertarget dependencies
   void AppendTargetDepends(std::vector<std::string>& depends);
 
+  // Append link rule dependencies (objects, etc.).
+  void AppendLinkDepends(std::vector<std::string>& depends);
+
   /** In order to support parallel builds for custom commands with
       multiple outputs the outputs are given a serial order, and only
       the first output actually has the build rule.  Other outputs

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

Summary of changes:
 Source/cmMakefileExecutableTargetGenerator.cxx     |   27 +-------------
 Source/cmMakefileLibraryTargetGenerator.cxx        |   25 +------------
 Source/cmMakefileTargetGenerator.cxx               |   38 ++++++++++++++++++++
 Source/cmMakefileTargetGenerator.h                 |    3 ++
 Source/cmTarget.cxx                                |   12 ++++++
 Tests/BuildDepends/CMakeLists.txt                  |   23 ++++++++++++
 Tests/BuildDepends/Project/CMakeLists.txt          |    5 +++
 .../BuildDepends/Project/linkdep.cxx               |    0
 8 files changed, 83 insertions(+), 50 deletions(-)
 copy Modules/DummyCXXFile.cxx => Tests/BuildDepends/Project/linkdep.cxx (100%)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list