diff options
| author | Roy Ivy III <[email protected]> | 2018-10-31 12:34:42 -0500 |
|---|---|---|
| committer | Roy Ivy III <[email protected]> | 2018-11-02 11:13:26 -0500 |
| commit | 8c6cd6b4dc6b6a6b18150480d9711595f0043f26 (patch) | |
| tree | d86124ab1514581e0711d16ff24799dcc7e8cd24 | |
| parent | 46376463b39d25a0aeb688cc5dfa3ca374d5c2b0 (diff) | |
fix find_vstudio sorting/choice of MSVC/VS by forcing numerical sorting
.# Discussion
When multiple MSVC/VS versions are installed and the version is not specified,
`xmake` chooses the most recent version of MSVC/VS. This choice is made based
upon a sort of the `vsver` values (used for registry lookup; some are years
and some are version numbers). Because of the year/version disparity, some
MSVC/VS installation combinations would result in earlier versions being chosen
erroneously. But a numerical (non-string) sort does result in the correct
ordering. This commit forces that numerical-type sort.
| -rw-r--r-- | xmake/platforms/windows/check.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/xmake/platforms/windows/check.lua b/xmake/platforms/windows/check.lua index 34c8f004f..9ac599815 100644 --- a/xmake/platforms/windows/check.lua +++ b/xmake/platforms/windows/check.lua @@ -49,7 +49,7 @@ function _check_vsenv(config) table.insert(vsvers, vsver) end end - table.sort(vsvers, function (a, b) return a > b end) + table.sort(vsvers, function (a, b) return tonumber(a) > tonumber(b) end) if vs then table.insert(vsvers, 1, vs) end |
