list(SORT): Add COMPARATOR option for user-defined comparisons

Allow users to provide a custom comparison function for `list(SORT)`.
The comparator is validated for strict weak ordering at runtime to
produce a clear CMake error rather than a platform-dependent abort.

Closes: #27761
31 files changed