[Cmake-commits] CMake branch, next, updated. v3.0.0-rc2-1314-g5b45b01

Stephen Kelly steveire at gmail.com
Thu Mar 20 16:41:24 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  5b45b017c10c8e72eb996e836fdad12e438e1679 (commit)
       via  ae1bb903cea54edd506a60ca764d8cdf6cbed399 (commit)
      from  6be768de6f73152c816db2dcbaced3208f33939e (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=5b45b017c10c8e72eb996e836fdad12e438e1679
commit 5b45b017c10c8e72eb996e836fdad12e438e1679
Merge: 6be768d ae1bb90
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Mar 20 16:41:23 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Mar 20 16:41:23 2014 -0400

    Merge topic 'target-sources-refactor' into next
    
    ae1bb903 cmSourceFileLocation: Normalize the directory member.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ae1bb903cea54edd506a60ca764d8cdf6cbed399
commit ae1bb903cea54edd506a60ca764d8cdf6cbed399
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Mar 20 21:09:33 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Mar 20 21:40:14 2014 +0100

    cmSourceFileLocation: Normalize the directory member.
    
    Otherwise Matches() ends up doing a comparison of
    the directories
    
     /path/to/dir/subdir/..
    
    and
    
     /path/to/dir
    
    as strings and not matching where it should.

diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index 3e78b29..d31af89 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -225,6 +225,13 @@ cmSourceFileLocation
   return false;
 }
 
+static bool isSameDirectory(std::string const& dir1, std::string const& dir2)
+{
+  std::string norm1 = cmsys::SystemTools::GetRealPath(dir1.c_str());
+  std::string norm2 = cmsys::SystemTools::GetRealPath(dir2.c_str());
+  return norm1 == norm2;
+}
+
 //----------------------------------------------------------------------------
 bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
 {
@@ -267,7 +274,7 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
   if(!this->AmbiguousDirectory && !loc.AmbiguousDirectory)
     {
     // Both sides have absolute directories.
-    if(this->Directory != loc.Directory)
+    if(!isSameDirectory(this->Directory, loc.Directory))
       {
       return false;
       }
@@ -276,7 +283,7 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
           this->Makefile == loc.Makefile)
     {
     // Both sides have directories relative to the same location.
-    if(this->Directory != loc.Directory)
+    if(!isSameDirectory(this->Directory, loc.Directory))
       {
       return false;
       }
@@ -303,8 +310,8 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
     std::string binDir =
       cmSystemTools::CollapseFullPath(
         this->Directory.c_str(), this->Makefile->GetCurrentOutputDirectory());
-    if(srcDir != loc.Directory &&
-       binDir != loc.Directory)
+    if(!isSameDirectory(srcDir, loc.Directory) &&
+       !isSameDirectory(binDir, loc.Directory))
       {
       return false;
       }
@@ -318,8 +325,8 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
     std::string binDir =
       cmSystemTools::CollapseFullPath(
         loc.Directory.c_str(), loc.Makefile->GetCurrentOutputDirectory());
-    if(srcDir != this->Directory &&
-       binDir != this->Directory)
+    if(!isSameDirectory(srcDir, this->Directory) &&
+       !isSameDirectory(binDir, this->Directory))
       {
       return false;
       }
diff --git a/Tests/Properties/CMakeLists.txt b/Tests/Properties/CMakeLists.txt
index 285d596..11fca45 100644
--- a/Tests/Properties/CMakeLists.txt
+++ b/Tests/Properties/CMakeLists.txt
@@ -143,3 +143,5 @@ set_property(CACHE SOME_ENTRY PROPERTY VALUE "${expect_VALUE}")
 set_property(CACHE SOME_ENTRY PROPERTY ADVANCED "${expect_ADVANCED}")
 set_property(CACHE SOME_ENTRY PROPERTY STRINGS "${expect_STRINGS}")
 check_cache_props()
+
+add_subdirectory(SubDir2)
diff --git a/Tests/Properties/SubDir2/CMakeLists.txt b/Tests/Properties/SubDir2/CMakeLists.txt
new file mode 100644
index 0000000..377dc83
--- /dev/null
+++ b/Tests/Properties/SubDir2/CMakeLists.txt
@@ -0,0 +1,5 @@
+
+set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/../subdirtest.cxx"
+  PROPERTIES COMPILE_DEFINITIONS SUBDIR_TEST)
+
+add_executable(subdirtest "${CMAKE_CURRENT_SOURCE_DIR}/../subdirtest.cxx")
diff --git a/Tests/Properties/subdirtest.cxx b/Tests/Properties/subdirtest.cxx
new file mode 100644
index 0000000..02d8f3d
--- /dev/null
+++ b/Tests/Properties/subdirtest.cxx
@@ -0,0 +1,9 @@
+
+#ifndef SUBDIR_TEST
+#error Expected SUBDIR_TEST
+#endif
+
+int main(int, char**)
+{
+  return 0;
+}

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

Summary of changes:
 Source/cmSourceFileLocation.cxx         |   19 +++++++++++++------
 Tests/Properties/CMakeLists.txt         |    2 ++
 Tests/Properties/SubDir2/CMakeLists.txt |    5 +++++
 Tests/Properties/subdirtest.cxx         |    9 +++++++++
 4 files changed, 29 insertions(+), 6 deletions(-)
 create mode 100644 Tests/Properties/SubDir2/CMakeLists.txt
 create mode 100644 Tests/Properties/subdirtest.cxx


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list