[Cmake-commits] CMake branch, next, updated. v3.0.1-5200-g0dc66cf

Brad King brad.king at kitware.com
Mon Sep 8 11:40:43 EDT 2014


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  0dc66cfafe6f5bc1e6a0e0622cd784a28573b304 (commit)
       via  87b434bec21c34b040401b596eecde3554b20933 (commit)
       via  093a03f6ff197e7a1cf50b781d6762f7283a78ae (commit)
      from  916ff4bf097452b4621addd1df775c950dcf129d (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=0dc66cfafe6f5bc1e6a0e0622cd784a28573b304
commit 0dc66cfafe6f5bc1e6a0e0622cd784a28573b304
Merge: 916ff4b 87b434b
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Sep 8 11:40:42 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Sep 8 11:40:42 2014 -0400

    Merge topic 'update-kwsys' into next
    
    87b434be Merge branch 'upstream-kwsys' into update-kwsys
    093a03f6 KWSys 2014-09-08 (80e852f6)


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=87b434bec21c34b040401b596eecde3554b20933
commit 87b434bec21c34b040401b596eecde3554b20933
Merge: 1251c1c 093a03f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Sep 8 11:42:00 2014 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Sep 8 11:42:00 2014 -0400

    Merge branch 'upstream-kwsys' into update-kwsys


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=093a03f6ff197e7a1cf50b781d6762f7283a78ae
commit 093a03f6ff197e7a1cf50b781d6762f7283a78ae
Author:     KWSys Robot <kwrobot at kitware.com>
AuthorDate: Mon Sep 8 09:54:24 2014 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Sep 8 11:41:57 2014 -0400

    KWSys 2014-09-08 (80e852f6)
    
    Extract upstream KWSys using the following shell commands.
    
    $ git archive --prefix=upstream-kwsys/ 80e852f6 | tar x
    $ git shortlog --no-merges --abbrev=8 --format='%h %s' 32023afd..80e852f6
    Brad King (1):
          80e852f6 kwsysPlatformTests: Use if(DEFINED) to simplify conditions
    
    Clinton Stimpson (1):
          93eb1a1f SystemTools: Improve RelativePath() to handle ./ ../ and //
    
    Change-Id: I6dd3f033adf1a91c83e0517d8fac16eaf8da1a03

diff --git a/SystemTools.cxx b/SystemTools.cxx
index e34bb43..87fdfbe 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -3425,9 +3425,12 @@ kwsys_stl::string SystemTools::RelativePath(const kwsys_stl::string& local, cons
     return "";
     }
 
+  kwsys_stl::string l = SystemTools::CollapseFullPath(local);
+  kwsys_stl::string r = SystemTools::CollapseFullPath(remote);
+
   // split up both paths into arrays of strings using / as a separator
-  kwsys_stl::vector<kwsys::String> localSplit = SystemTools::SplitString(local, '/', true);
-  kwsys_stl::vector<kwsys::String> remoteSplit = SystemTools::SplitString(remote, '/', true);
+  kwsys_stl::vector<kwsys::String> localSplit = SystemTools::SplitString(l, '/', true);
+  kwsys_stl::vector<kwsys::String> remoteSplit = SystemTools::SplitString(r, '/', true);
   kwsys_stl::vector<kwsys::String> commonPath; // store shared parts of path in this array
   kwsys_stl::vector<kwsys::String> finalPath;  // store the final relative path here
   // count up how many matching directory names there are from the start
diff --git a/kwsysPlatformTests.cmake b/kwsysPlatformTests.cmake
index f9ee254..16bc969 100644
--- a/kwsysPlatformTests.cmake
+++ b/kwsysPlatformTests.cmake
@@ -13,7 +13,7 @@ SET(KWSYS_PLATFORM_TEST_FILE_C kwsysPlatformTestsC.c)
 SET(KWSYS_PLATFORM_TEST_FILE_CXX kwsysPlatformTestsCXX.cxx)
 
 MACRO(KWSYS_PLATFORM_TEST lang var description invert)
-  IF("${var}_COMPILED" MATCHES "^${var}_COMPILED$")
+  IF(NOT DEFINED ${var}_COMPILED)
     MESSAGE(STATUS "${description}")
     TRY_COMPILE(${var}_COMPILED
       ${CMAKE_CURRENT_BINARY_DIR}
@@ -43,7 +43,7 @@ MACRO(KWSYS_PLATFORM_TEST lang var description invert)
         MESSAGE(STATUS "${description} - no")
       ENDIF(${var}_COMPILED)
     ENDIF(${invert} MATCHES INVERT)
-  ENDIF("${var}_COMPILED" MATCHES "^${var}_COMPILED$")
+  ENDIF()
   IF(${invert} MATCHES INVERT)
     IF(${var}_COMPILED)
       SET(${var} 0)
@@ -60,7 +60,7 @@ MACRO(KWSYS_PLATFORM_TEST lang var description invert)
 ENDMACRO(KWSYS_PLATFORM_TEST)
 
 MACRO(KWSYS_PLATFORM_TEST_RUN lang var description invert)
-  IF("${var}" MATCHES "^${var}$")
+  IF(NOT DEFINED ${var})
     MESSAGE(STATUS "${description}")
     TRY_RUN(${var} ${var}_COMPILED
       ${CMAKE_CURRENT_BINARY_DIR}
@@ -107,7 +107,7 @@ MACRO(KWSYS_PLATFORM_TEST_RUN lang var description invert)
         MESSAGE(STATUS "${description} - failed to compile")
       ENDIF(${var}_COMPILED)
     ENDIF(${invert} MATCHES INVERT)
-  ENDIF("${var}" MATCHES "^${var}$")
+  ENDIF()
 
   IF(${invert} MATCHES INVERT)
     IF(${var}_COMPILED)
diff --git a/testSystemTools.cxx b/testSystemTools.cxx
index 04ab4fc..a7cfa0d 100644
--- a/testSystemTools.cxx
+++ b/testSystemTools.cxx
@@ -562,6 +562,33 @@ static bool CheckEnvironmentOperations()
   return res;
 }
 
+
+static bool CheckRelativePath(
+  const kwsys_stl::string& local,
+  const kwsys_stl::string& remote,
+  const kwsys_stl::string& expected)
+{
+  kwsys_stl::string result = kwsys::SystemTools::RelativePath(local, remote);
+  if(expected != result)
+    {
+    kwsys_ios::cerr << "RelativePath(" << local << ", " << remote
+      << ")  yielded " << result << " instead of " << expected << kwsys_ios::endl;
+    return false;
+    }
+  return true;
+}
+
+static bool CheckRelativePaths()
+{
+  bool res = true;
+  res &= CheckRelativePath("/usr/share", "/bin/bash", "../../bin/bash");
+  res &= CheckRelativePath("/usr/./share/", "/bin/bash", "../../bin/bash");
+  res &= CheckRelativePath("/usr//share/", "/bin/bash", "../../bin/bash");
+  res &= CheckRelativePath("/usr/share/../bin/", "/bin/bash", "../../bin/bash");
+  res &= CheckRelativePath("/usr/share", "/usr/share//bin", "bin");
+  return res;
+}
+
 //----------------------------------------------------------------------------
 int testSystemTools(int, char*[])
 {
@@ -593,5 +620,7 @@ int testSystemTools(int, char*[])
 
   res &= CheckEnvironmentOperations();
 
+  res &= CheckRelativePaths();
+
   return res ? 0 : 1;
 }

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list