diff options
| author | ruki <[email protected]> | 2024-03-06 22:45:40 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-03-06 22:45:40 +0800 |
| commit | f626872aa7b36db8870a8e4e1ff82c9bcceb8b2f (patch) | |
| tree | d3abea409ddf2ae9c709df4706b509073f3ddfbd /xmake/modules/package/tools/cmake.lua | |
| parent | b02da01326793d01af304f912f243a2b38b5bd92 (diff) | |
fix vs toolset v144 for cmake #4772
Diffstat (limited to 'xmake/modules/package/tools/cmake.lua')
| -rw-r--r-- | xmake/modules/package/tools/cmake.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 4c73cd5d1..b1ebbbef7 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -20,6 +20,7 @@ -- imports import("core.base.option") +import("core.base.semver") import("core.tool.toolchain") import("core.project.config") import("core.tool.linker") @@ -274,6 +275,19 @@ function _get_shflags(package, opt) end end +-- get cmake version +function _get_cmake_version() + local cmake_version = _g.cmake_version + if not cmake_version then + local cmake = find_tool("cmake", {version = true}) + if cmake and cmake.version then + cmake_version = semver.new(cmake.version) + end + _g.cmake_version = cmake_version + end + return cmake_version +end + -- get vs toolset function _get_vs_toolset(package) local toolset_ver = nil @@ -284,6 +298,14 @@ function _get_vs_toolset(package) toolset_ver = "v" .. verinfo[1] .. (verinfo[2]:sub(1, 1) or "0") end end + -- cmake does not support vs toolset v144 below 3.29.0, we can only use v143 + -- @see https://github.com/xmake-io/xmake/issues/4772 + if toolset_ver and toolset_ver >= "v144" then + local cmake_version = _get_cmake_version() + if cmake_version and cmake_version:le("3.29.0") then + toolset_ver = "v143" + end + end return toolset_ver end @@ -1062,3 +1084,4 @@ function install(package, configs, opt) end os.cd(oldir) end + |
