summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-03-23 22:55:56 +0800
committerruki <[email protected]>2021-03-23 22:55:56 +0800
commit96b335a5fe5cd6d71a79776d63fa6f3eb2fa7379 (patch)
treee6db2f75ea7bdada391310b830d07a8d6ae1d500
parent53ec61959556a7efc83a1f1a0c9e17f0dd4466a1 (diff)
fix cmake path
-rw-r--r--xmake/modules/target/action/install/cmake_importfiles.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/xmake/modules/target/action/install/cmake_importfiles.lua b/xmake/modules/target/action/install/cmake_importfiles.lua
index 0279fe2f9..ff15deba4 100644
--- a/xmake/modules/target/action/install/cmake_importfiles.lua
+++ b/xmake/modules/target/action/install/cmake_importfiles.lua
@@ -21,14 +21,22 @@
-- imports
import("core.project.project")
+-- translate path
+function _translate_path(p)
+ if is_host("windows") then
+ return (p:gsub("\\", "/"))
+ end
+ return p
+end
+
-- get the builtin variables
function _get_builtinvars(target, installdir)
return {TARGETNAME = target:name(),
PROJECTNAME = project.name() or target:name(),
- TARGETFILE = path.absolute(target:targetfile()),
+ TARGETFILE = _translate_path(path.absolute(target:targetfile())),
TARGETKIND = target:is_shared() and "SHARED" or "STATIC",
PACKAGE_VERSION = target:get("version") or "1.0.0",
- IMPORT_PREFIX = path.absolute(installdir)}
+ IMPORT_PREFIX = _translate_path(path.absolute(installdir))}
end
-- install cmake import file