diff options
| author | Yc7521 <[email protected]> | 2024-10-18 10:51:20 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-10-18 10:51:20 +0800 |
| commit | e1e4635d3112cd627b80f47cc06ee4f5140ad3fe (patch) | |
| tree | 6ba50592eda30f37270616bd67f1685d98aee27e /xmake/modules | |
| parent | 86627f20f80a50fece956b4e8394afc4b5a83cd1 (diff) | |
Update cmake_importfiles
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/target/action/install/cmake_importfiles.lua | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/xmake/modules/target/action/install/cmake_importfiles.lua b/xmake/modules/target/action/install/cmake_importfiles.lua index 1249c9c8b..814ff0fb5 100644 --- a/xmake/modules/target/action/install/cmake_importfiles.lua +++ b/xmake/modules/target/action/install/cmake_importfiles.lua @@ -43,7 +43,7 @@ function _get_builtinvars(target, installdir) TARGETFILENAME = target:targetfile() and _get_libfile(target, installdir), TARGETKIND = target:is_headeronly() and "INTERFACE" or (target:is_shared() and "SHARED" or "STATIC"), PACKAGE_VERSION = target:get("version") or "1.0.0", - TARGET_PTRBYTES = target:is_arch("x86", "i386") and "4" or "8"} + TARGET_PTRBYTES = target:is_arch("armeabi", "armeabi-v7a", "x86", "mips", "i386", "armv7", "armv7s", "mipsel", "wasm32") and "4" or "8"} end -- install cmake config file @@ -130,6 +130,16 @@ function _install_cmake_targetfile(target, installdir, filename, opt) local value = builtinvars[variable] return type(value) == "function" and value() or value end) + local libfile = path.filename(target:targetfile()) + local postfix = is_mode("debug") and "DEBUG" or "RELEASE" + if target:is_shared() and (_get_libfile(target, installdir) ~= libfile) then + -- On DLL platforms, the import library is named differently from the target file + content = content:gsub("# IMPORTED_IMPLIB_" .. postfix, "IMPORTED_IMPLIB_" .. postfix) + content = content:gsub( + "IMPORTED_LOCATION_" .. postfix .. " \"${_IMPORT_PREFIX}/lib/.-\"", + "IMPORTED_LOCATION_" .. postfix .. " \"${_IMPORT_PREFIX}/bin/" .. libfile .. "\"" + ) + end io.writefile(importfile_dst, content) end end |
