summaryrefslogtreecommitdiffstats
path: root/Source/cmOrderLinkDirectories.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-03-02 16:48:58 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-03-02 16:48:58 (GMT)
commit1b68c76b1978b8edd4703d31b8c2befc65b60a0f (patch)
treeacdfd767be359d303f3a089981ea4e270e33ae7d /Source/cmOrderLinkDirectories.cxx
parent66a61e9c745660491e776fdbaed6d6ca8bdd9a52 (diff)
downloadCMake-1b68c76b1978b8edd4703d31b8c2befc65b60a0f.zip
CMake-1b68c76b1978b8edd4703d31b8c2befc65b60a0f.tar.gz
CMake-1b68c76b1978b8edd4703d31b8c2befc65b60a0f.tar.bz2
BUG: Attempt to fix sorting stability using more deterministic compare function
Diffstat (limited to 'Source/cmOrderLinkDirectories.cxx')
-rw-r--r--Source/cmOrderLinkDirectories.cxx20
1 files changed, 12 insertions, 8 deletions
diff --git a/Source/cmOrderLinkDirectories.cxx b/Source/cmOrderLinkDirectories.cxx
index 86a7cbe..09f1f85 100644
--- a/Source/cmOrderLinkDirectories.cxx
+++ b/Source/cmOrderLinkDirectories.cxx
@@ -158,17 +158,20 @@ struct cmOrderLinkDirectoriesCompare
const cmStdString& right
) const
{
- bool ret = This->CanBeBefore(left, right);
- if(!ret)
+ bool LBeforeR= This->CanBeBefore(left, right);
+ bool RBeforeL= This->CanBeBefore(right, left);
+
+ if ( !LBeforeR && !RBeforeL )
{
// check for the case when both libraries have to come
// before each other
- if(!This->CanBeBefore(right, left))
- {
- This->AddImpossible(right, left);
- }
+ This->AddImpossible(right, left);
+ }
+ if ( LBeforeR == RBeforeL )
+ {
+ return strcmp(left.c_str(), right.c_str()) < 0;
}
- return ret;
+ return LBeforeR;
}
cmOrderLinkDirectories* This;
};
@@ -189,7 +192,8 @@ void cmOrderLinkDirectories::OrderPaths(std::vector<cmStdString>&
comp.This = this;
// for some reason when cmake is run on InsightApplication
// if std::sort is used here cmake crashes, but stable_sort works
- std::stable_sort(orderedPaths.begin(), orderedPaths.end(), comp);
+ //
+ std::sort(orderedPaths.begin(), orderedPaths.end(), comp);
}
//-------------------------------------------------------------------