From 1fd9fbb24a9bbca21d3783c5fbe49fe74ad54ca8 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 20 Oct 2020 00:55:14 +0800 Subject: improve to find_vcpkgdir --- CHANGELOG.md | 2 ++ xmake/modules/detect/sdks/find_vcpkgdir.lua | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14f0eba76..1c3262712 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * [#997](https://github.com/xmake-io/xmake/issues/997): Support to set std lanuages for `xmake project -k cmake` * [#998](https://github.com/xmake-io/xmake/issues/998): Support to install vcpkg packages with windows-static-md +* [#996](https://github.com/xmake-io/xmake/issues/996): Improve to find vcpkg directory ## v2.3.8 @@ -851,6 +852,7 @@ * [#997](https://github.com/xmake-io/xmake/issues/997): `xmake project -k cmake` 插件增加对 `set_languages` 的支持 * [#998](https://github.com/xmake-io/xmake/issues/998): 支持安装 windows-static-md 类型的 vcpkg 包 +* [#996](https://github.com/xmake-io/xmake/issues/996): 改进 vcpkg 目录查找 ## v2.3.8 diff --git a/xmake/modules/detect/sdks/find_vcpkgdir.lua b/xmake/modules/detect/sdks/find_vcpkgdir.lua index de8cba24e..8df048f25 100644 --- a/xmake/modules/detect/sdks/find_vcpkgdir.lua +++ b/xmake/modules/detect/sdks/find_vcpkgdir.lua @@ -42,8 +42,16 @@ function _find_vcpkgdir(sdkdir) table.insert(paths, dir) end end - else - -- TODO + end + + -- attempt to find it from the $PATH + local pathenv = os.getenv("PATH") + if pathenv then + for _, p in ipairs(path.splitenv(pathenv)) do + if p:find(string.ipattern("[\\/]vcpkg")) and os.isdir(p) then + table.insert(paths, p) + end + end end -- attempt to find vcpkg -- cgit v1.3.1