[Cmake-commits] CMake branch, next, updated. v2.8.3-774-gd573a40

Brad King brad.king at kitware.com
Wed Dec 8 17:34:31 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  d573a40451e90b5527924e28b022868a8864d07f (commit)
       via  ced1d5eccd4ae08a6431a5c163be3dd52ca9d59a (commit)
       via  e30a775f68ddae48ca6987fc2c21c07844a26804 (commit)
      from  7bc03a468805df1fbc89d18d4976f521fa8b2960 (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=d573a40451e90b5527924e28b022868a8864d07f
commit d573a40451e90b5527924e28b022868a8864d07f
Merge: 7bc03a4 ced1d5e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Dec 8 17:34:24 2010 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Dec 8 17:34:24 2010 -0500

    Merge topic 'custom-command-depend' into next
    
    ced1d5e Skip file-level dependencies on custom targets (#11332)
    e30a775 Improve signature of cmLocalGenerator::GetRealDependency


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ced1d5eccd4ae08a6431a5c163be3dd52ca9d59a
commit ced1d5eccd4ae08a6431a5c163be3dd52ca9d59a
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Dec 8 17:05:23 2010 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 8 17:14:17 2010 -0500

    Skip file-level dependencies on custom targets (#11332)
    
    A custom command may name a target created by add_custom_target in its
    DEPENDS field.  Treat this case as a target-level dependency only since
    a custom target provides no standard file on which to add a file-level
    dependency.

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 6b37eaf..b7d694c 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1878,10 +1878,9 @@ bool cmLocalGenerator::GetRealDependency(const char* inName,
         break;
       case cmTarget::UTILITY:
       case cmTarget::GLOBAL_TARGET:
-        // Depending on a utility target may not work but just trust
-        // the user to have given a valid name.
-        dep = inName;
-        return true;
+        // A utility target has no file on which to depend.  This was listed
+        // only to get the target-level dependency.
+        return false;
       case cmTarget::INSTALL_FILES:
       case cmTarget::INSTALL_PROGRAMS:
       case cmTarget::INSTALL_DIRECTORY:
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 486c385..870ce36 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -158,6 +158,7 @@ public:
 
   /** Translate a dependency as given in CMake code to the name to
       appear in a generated build file.  If the given name is that of
+      a utility target, returns false.  If the given name is that of
       a CMake target it will be transformed to the real output
       location of that target for the given configuration.  If the
       given name is the full path to a file it will be returned.
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index 76208d4..746c9a7 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -130,6 +130,7 @@ ADD_CUSTOM_COMMAND(
 ################################################################
 ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/foo.pre
   DEPENDS ${PROJECT_SOURCE_DIR}/foo.in
+          TDocument # Ensure doc1.h generates before this target
   COMMAND   ${CMAKE_COMMAND}  
   ARGS      -E copy ${PROJECT_SOURCE_DIR}/foo.in 
   ${PROJECT_BINARY_DIR}/foo.pre
@@ -181,10 +182,6 @@ ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/generated.c
 
 TARGET_LINK_LIBRARIES(CustomCommand GeneratedHeader)
 
-# must add a dependency on TDocument otherwise it might never build and 
-# the CustomCommand executable really needs doc1.h
-ADD_DEPENDENCIES(CustomCommand TDocument)
-
 ##############################################################################
 # Test for using just the target name as executable in the COMMAND
 # section. Has to be recognized and replaced by CMake with the output

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e30a775f68ddae48ca6987fc2c21c07844a26804
commit e30a775f68ddae48ca6987fc2c21c07844a26804
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Dec 8 16:51:16 2010 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Dec 8 17:14:14 2010 -0500

    Improve signature of cmLocalGenerator::GetRealDependency
    
    Allow file-level custom command dependencies to be skipped.

diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 2f7bc44..29c2d06 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1334,11 +1334,13 @@ void  cmGlobalXCodeGenerator
           cc.GetDepends().begin();
           d != cc.GetDepends().end(); ++d)
         {
-        std::string dep =
-          this->CurrentLocalGenerator->GetRealDependency(d->c_str(),
-                                                         configName);
-        makefileStream << "\\\n" << this
-          ->ConvertToRelativeForMake(dep.c_str());
+        std::string dep;
+        if(this->CurrentLocalGenerator
+           ->GetRealDependency(d->c_str(), configName, dep))
+          {
+          makefileStream << "\\\n" <<
+            this->ConvertToRelativeForMake(dep.c_str());
+          }
         }
       makefileStream << "\n";
 
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 5bffd52..6b37eaf 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1818,8 +1818,9 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
 }
 
 //----------------------------------------------------------------------------
-std::string cmLocalGenerator::GetRealDependency(const char* inName,
-                                                const char* config)
+bool cmLocalGenerator::GetRealDependency(const char* inName,
+                                         const char* config,
+                                         std::string& dep)
 {
   // Older CMake code may specify the dependency using the target
   // output file rather than the target name.  Such code would have
@@ -1855,7 +1856,8 @@ std::string cmLocalGenerator::GetRealDependency(const char* inName,
         // it is a full path to a depend that has the same name
         // as a target but is in a different location so do not use
         // the target as the depend
-        return inName;
+        dep = inName;
+        return true;
         }
       }
     switch (target->GetType())
@@ -1869,7 +1871,8 @@ std::string cmLocalGenerator::GetRealDependency(const char* inName,
         // Get the location of the target's output file and depend on it.
         if(const char* location = target->GetLocation(config))
           {
-          return location;
+          dep = location;
+          return true;
           }
         }
         break;
@@ -1877,7 +1880,8 @@ std::string cmLocalGenerator::GetRealDependency(const char* inName,
       case cmTarget::GLOBAL_TARGET:
         // Depending on a utility target may not work but just trust
         // the user to have given a valid name.
-        return inName;
+        dep = inName;
+        return true;
       case cmTarget::INSTALL_FILES:
       case cmTarget::INSTALL_PROGRAMS:
       case cmTarget::INSTALL_DIRECTORY:
@@ -1889,23 +1893,24 @@ std::string cmLocalGenerator::GetRealDependency(const char* inName,
   if(cmSystemTools::FileIsFullPath(inName))
     {
     // This is a full path.  Return it as given.
-    return inName;
+    dep = inName;
+    return true;
     }
 
   // Check for a source file in this directory that matches the
   // dependency.
   if(cmSourceFile* sf = this->Makefile->GetSource(inName))
     {
-    name = sf->GetFullPath();
-    return name;
+    dep = sf->GetFullPath();
+    return true;
     }
 
   // Treat the name as relative to the source directory in which it
   // was given.
-  name = this->Makefile->GetCurrentDirectory();
-  name += "/";
-  name += inName;
-  return name;
+  dep = this->Makefile->GetCurrentDirectory();
+  dep += "/";
+  dep += inName;
+  return true;
 }
 
 //----------------------------------------------------------------------------
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 43bf1e7..486c385 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -164,8 +164,9 @@ public:
       Otherwise the name is treated as a relative path with respect to
       the source directory of this generator.  This should only be
       used for dependencies of custom commands.  */
-  std::string GetRealDependency(const char* name, const char* config);
-  
+  bool GetRealDependency(const char* name, const char* config,
+                         std::string& dep);
+
   /** Translate a command as given in CMake code to the location of the 
       executable if the command is the name of a CMake executable target.
       If that's not the case, just return the original name. */
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index c5d8c0d..15ae139 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -902,9 +902,12 @@ cmLocalUnixMakefileGenerator3
       d != cc.GetDepends().end(); ++d)
     {
     // Lookup the real name of the dependency in case it is a CMake target.
-    std::string dep = this->GetRealDependency
-      (d->c_str(), this->ConfigurationName.c_str());
-    depends.push_back(dep);
+    std::string dep;
+    if(this->GetRealDependency(d->c_str(), this->ConfigurationName.c_str(),
+                               dep))
+      {
+      depends.push_back(dep);
+      }
     }
 }
 
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index eb4e4a4..b50c133 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -686,10 +686,12 @@ cmLocalVisualStudio6Generator
         ++d)
       {
       // Lookup the real name of the dependency in case it is a CMake target.
-      std::string dep = this->GetRealDependency(d->c_str(),
-                                                config.c_str());
-      fout << "\\\n\t" <<
-        this->ConvertToOptionallyRelativeOutputPath(dep.c_str());
+      std::string dep;
+      if(this->GetRealDependency(d->c_str(), config.c_str(), dep))
+        {
+        fout << "\\\n\t" <<
+          this->ConvertToOptionallyRelativeOutputPath(dep.c_str());
+        }
       }
     fout << "\n";
 
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 7fd7fd2..9a87cc4 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1624,9 +1624,12 @@ WriteCustomRule(std::ostream& fout,
           ++d)
         {
         // Get the real name of the dependency in case it is a CMake target.
-        std::string dep = this->GetRealDependency(d->c_str(), i->c_str());
-        fout << this->ConvertToXMLOutputPath(dep.c_str())
-             << ";";
+        std::string dep;
+        if(this->GetRealDependency(d->c_str(), i->c_str(), dep))
+          {
+          fout << this->ConvertToXMLOutputPath(dep.c_str())
+               << ";";
+          }
         }
       }
     fout << "\"\n";
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 524be8b..1d885e0 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -386,10 +386,12 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
         d != command.GetDepends().end(); 
         ++d)
       {
-      std::string dep = this->LocalGenerator->
-        GetRealDependency(d->c_str(), i->c_str());
-      this->ConvertToWindowsSlash(dep);
-      (*this->BuildFileStream ) << ";" << dep;
+      std::string dep;
+      if(this->LocalGenerator->GetRealDependency(d->c_str(), i->c_str(), dep))
+        {
+        this->ConvertToWindowsSlash(dep);
+        (*this->BuildFileStream ) << ";" << dep;
+        }
       }
     (*this->BuildFileStream ) << ";%(AdditionalInputs)</AdditionalInputs>\n";
     this->WritePlatformConfigTag("Outputs", i->c_str(), 3);

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

Summary of changes:
 Source/cmGlobalXCodeGenerator.cxx          |   12 ++++++----
 Source/cmLocalGenerator.cxx                |   32 +++++++++++++++------------
 Source/cmLocalGenerator.h                  |    6 +++-
 Source/cmLocalUnixMakefileGenerator3.cxx   |    9 +++++--
 Source/cmLocalVisualStudio6Generator.cxx   |   10 +++++---
 Source/cmLocalVisualStudio7Generator.cxx   |    9 +++++--
 Source/cmVisualStudio10TargetGenerator.cxx |   10 +++++---
 Tests/CustomCommand/CMakeLists.txt         |    5 +---
 8 files changed, 54 insertions(+), 39 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list