summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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