[Cmake-commits] CMake branch, next, updated. v2.8.3-1500-g29e6c00

Brad King brad.king at kitware.com
Thu Jan 27 08:01:14 EST 2011


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  29e6c00f5d95684717a43205ed70a902853c0bb2 (commit)
       via  88548a45fbd35205469ac9fd332349551e172496 (commit)
       via  7befc00783ca9739e7585ff4d2b645a762a38396 (commit)
      from  626e8c1250f3758a9bee4681444629b080f006b4 (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=29e6c00f5d95684717a43205ed70a902853c0bb2
commit 29e6c00f5d95684717a43205ed70a902853c0bb2
Merge: 626e8c1 88548a4
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jan 27 08:01:06 2011 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Jan 27 08:01:06 2011 -0500

    Merge topic 'custom-command-slashes' into next
    
    88548a4 Handle relative WORKING_DIRECTORY in add_custom_(command|target)
    7befc00 Handle trailing slashes on add_custom_command DEPENDS


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=88548a45fbd35205469ac9fd332349551e172496
commit 88548a45fbd35205469ac9fd332349551e172496
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 26 16:32:17 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Jan 26 18:02:02 2011 -0500

    Handle relative WORKING_DIRECTORY in add_custom_(command|target)
    
    This also fixes handling of trailing slashes in the directory name.

diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index 7af6ec8..502829e 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -286,6 +286,13 @@ bool cmAddCustomCommandCommand
     return false;
     }
 
+  // Convert working directory to a full path.
+  if(!working.empty())
+    {
+    const char* build_dir = this->Makefile->GetCurrentOutputDirectory();
+    working = cmSystemTools::CollapseFullPath(working.c_str(), build_dir);
+    }
+
   // Choose which mode of the command to use.
   bool escapeOldStyle = !verbatim;
   if(source.empty() && output.empty())
diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h
index 490e043..47b542c 100644
--- a/Source/cmAddCustomCommandCommand.h
+++ b/Source/cmAddCustomCommandCommand.h
@@ -110,6 +110,8 @@ public:
       "will be treated as PRE_LINK.\n"
       "If WORKING_DIRECTORY is specified the command will be executed "
       "in the directory given. "
+      "If it is a relative path it will be interpreted relative to the "
+      "build tree directory corresponding to the current source directory. "
       "If COMMENT is set, the value will be displayed as a "
       "message before the commands are executed at build time. "
       "If APPEND is specified the COMMAND and DEPENDS option values "
diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx
index edb787b..27dea98 100644
--- a/Source/cmAddCustomTargetCommand.cxx
+++ b/Source/cmAddCustomTargetCommand.cxx
@@ -166,6 +166,14 @@ bool cmAddCustomTargetCommand
     }
   }
 
+  // Convert working directory to a full path.
+  if(!working_directory.empty())
+    {
+    const char* build_dir = this->Makefile->GetCurrentOutputDirectory();
+    working_directory =
+      cmSystemTools::CollapseFullPath(working_directory.c_str(), build_dir);
+    }
+
   // Add the utility target to the makefile.
   bool escapeOldStyle = !verbatim;
   cmTarget* target =
diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h
index 7a2b396..6d94fb2 100644
--- a/Source/cmAddCustomTargetCommand.h
+++ b/Source/cmAddCustomTargetCommand.h
@@ -79,6 +79,8 @@ public:
       "empty target will be created. "
       "If WORKING_DIRECTORY is set, then the command will be run in that "
       "directory. "
+      "If it is a relative path it will be interpreted relative to the "
+      "build tree directory corresponding to the current source directory. "
       "If COMMENT is set, the value will be displayed as a "
       "message before the commands are executed at build time. "
       "Dependencies listed with the DEPENDS argument may reference files "
diff --git a/Tests/CustomCommandWorkingDirectory/CMakeLists.txt b/Tests/CustomCommandWorkingDirectory/CMakeLists.txt
index d272ffe..36d32e4 100644
--- a/Tests/CustomCommandWorkingDirectory/CMakeLists.txt
+++ b/Tests/CustomCommandWorkingDirectory/CMakeLists.txt
@@ -10,6 +10,7 @@ ADD_CUSTOM_COMMAND(
 
 SET_SOURCE_FILES_PROPERTIES(
   "${TestWorkingDir_BINARY_DIR}/customTarget.c"
+  "${TestWorkingDir_BINARY_DIR}/customTarget2.c"
   PROPERTIES GENERATED 1)
 
 ADD_EXECUTABLE(working "${TestWorkingDir_BINARY_DIR}/working.c" 
@@ -28,8 +29,14 @@ add_custom_command(
   OUTPUT working2.c # Relative to build tree
   COMMAND "${CMAKE_COMMAND}" -E copy ${TestWorkingDir_SOURCE_DIR}/working.c.in ../working2.c
   DEPENDS ${TestWorkingDir_SOURCE_DIR}/working.c.in/ # trailing slash should be removed
-  WORKING_DIRECTORY ${TestWorkingDir_BINARY_DIR}/work
+  WORKING_DIRECTORY work/ # Relative to build tree, trailing slash
   )
-add_executable(working2 working2.c ${TestWorkingDir_BINARY_DIR}/customTarget.c)
+add_executable(working2 working2.c ${TestWorkingDir_BINARY_DIR}/customTarget2.c)
+
+add_custom_target(
+  Custom2 ALL
+  COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${TestWorkingDir_SOURCE_DIR}/customTarget.c ../customTarget2.c
+  WORKING_DIRECTORY work/ # Relative to build tree, trailing slash
+)
 
 add_dependencies(working2 Custom2)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7befc00783ca9739e7585ff4d2b645a762a38396
commit 7befc00783ca9739e7585ff4d2b645a762a38396
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Wed Jan 26 16:29:52 2011 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Wed Jan 26 18:01:33 2011 -0500

    Handle trailing slashes on add_custom_command DEPENDS

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index d3cbc1f..cd265c1 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1893,6 +1893,7 @@ bool cmLocalGenerator::GetRealDependency(const char* inName,
     {
     // This is a full path.  Return it as given.
     dep = inName;
+    cmSystemTools::ConvertToUnixSlashes(dep);
     return true;
     }
 
diff --git a/Tests/CustomCommandWorkingDirectory/CMakeLists.txt b/Tests/CustomCommandWorkingDirectory/CMakeLists.txt
index 57cb712..d272ffe 100644
--- a/Tests/CustomCommandWorkingDirectory/CMakeLists.txt
+++ b/Tests/CustomCommandWorkingDirectory/CMakeLists.txt
@@ -9,8 +9,7 @@ ADD_CUSTOM_COMMAND(
 )
 
 SET_SOURCE_FILES_PROPERTIES(
-  "${TestWorkingDir_BINARY_DIR}/working.c" 
-  "${TestWorkingDir_BINARY_DIR}/customTarget.c" 
+  "${TestWorkingDir_BINARY_DIR}/customTarget.c"
   PROPERTIES GENERATED 1)
 
 ADD_EXECUTABLE(working "${TestWorkingDir_BINARY_DIR}/working.c" 
@@ -23,3 +22,14 @@ ADD_CUSTOM_TARGET(
 )
 
 ADD_DEPENDENCIES(working Custom)
+
+file(MAKE_DIRECTORY ${TestWorkingDir_BINARY_DIR}/work)
+add_custom_command(
+  OUTPUT working2.c # Relative to build tree
+  COMMAND "${CMAKE_COMMAND}" -E copy ${TestWorkingDir_SOURCE_DIR}/working.c.in ../working2.c
+  DEPENDS ${TestWorkingDir_SOURCE_DIR}/working.c.in/ # trailing slash should be removed
+  WORKING_DIRECTORY ${TestWorkingDir_BINARY_DIR}/work
+  )
+add_executable(working2 working2.c ${TestWorkingDir_BINARY_DIR}/customTarget.c)
+
+add_dependencies(working2 Custom2)

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

Summary of changes:
 Source/cmAddCustomCommandCommand.cxx               |    7 ++++++
 Source/cmAddCustomCommandCommand.h                 |    2 +
 Source/cmAddCustomTargetCommand.cxx                |    8 +++++++
 Source/cmAddCustomTargetCommand.h                  |    2 +
 Source/cmLocalGenerator.cxx                        |    1 +
 Tests/CustomCommandWorkingDirectory/CMakeLists.txt |   21 ++++++++++++++++++-
 6 files changed, 39 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list