summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-10-20 00:55:14 +0800
committerruki <[email protected]>2020-10-20 00:55:14 +0800
commit1fd9fbb24a9bbca21d3783c5fbe49fe74ad54ca8 (patch)
treead37c68602195ab915f06ec176b2115b12c69666
parent415059e05bab56da2ebc429155d55bbaf2efcd39 (diff)
improve to find_vcpkgdir
-rw-r--r--CHANGELOG.md2
-rw-r--r--xmake/modules/detect/sdks/find_vcpkgdir.lua12
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