From 96b335a5fe5cd6d71a79776d63fa6f3eb2fa7379 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 23 Mar 2021 22:55:56 +0800 Subject: fix cmake path --- xmake/modules/target/action/install/cmake_importfiles.lua | 12 ++++++++++-- 1 file 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 -- cgit v1.3.1