summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-07-19 14:22:15 +0800
committerGitHub <[email protected]>2021-07-19 14:22:15 +0800
commit4061f4d6627358f188bf00778fe296c967b9593e (patch)
treef4e19b96bf18f96f36203d8f9adde068597f8725
parent03ffb3cb797b7029653f77309c27722d9be78483 (diff)
parent16bb42a5ba02717685201f6702eb818cd0b99902 (diff)
Merge pull request #1525 from xq114/patch-1
improve cmake_importfiles
-rw-r--r--xmake/modules/target/action/install/cmake_importfiles.lua3
-rw-r--r--xmake/scripts/cmake_importfiles/xxxConfigVersion.cmake4
2 files changed, 4 insertions, 3 deletions
diff --git a/xmake/modules/target/action/install/cmake_importfiles.lua b/xmake/modules/target/action/install/cmake_importfiles.lua
index 7bfb5d636..12d044251 100644
--- a/xmake/modules/target/action/install/cmake_importfiles.lua
+++ b/xmake/modules/target/action/install/cmake_importfiles.lua
@@ -27,7 +27,8 @@ function _get_builtinvars(target, installdir)
PROJECTNAME = project.name() or target:name(),
TARGETFILENAME = path.filename(target:targetfile()),
TARGETKIND = target:is_shared() and "SHARED" or "STATIC",
- PACKAGE_VERSION = target:get("version") or "1.0.0"}
+ PACKAGE_VERSION = target:get("version") or "1.0.0",
+ TARGET_PTRBYTES = target:is_arch("x86", "i386") and "4" or "8"}
end
-- install cmake import file
diff --git a/xmake/scripts/cmake_importfiles/xxxConfigVersion.cmake b/xmake/scripts/cmake_importfiles/xxxConfigVersion.cmake
index 68ca4fbd6..f09774e12 100644
--- a/xmake/scripts/cmake_importfiles/xxxConfigVersion.cmake
+++ b/xmake/scripts/cmake_importfiles/xxxConfigVersion.cmake
@@ -41,8 +41,8 @@ if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
-if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
- math(EXPR installedBits "8 * 8")
+if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@TARGET_PTRBYTES@")
+ math(EXPR installedBits "@TARGET_PTRBYTES@ * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()