summaryrefslogtreecommitdiff
path: root/xmake/modules/package/tools/cmake.lua
diff options
context:
space:
mode:
authorChen Yufei <[email protected]>2022-03-23 21:05:33 +0800
committerChen Yufei <[email protected]>2022-03-23 21:20:09 +0800
commit4f49a9e1d57017620f62c600b2adf5a2ff48bb10 (patch)
treefd405e8c83041919ee1522193b6a70ad1eae7a2a /xmake/modules/package/tools/cmake.lua
parent90c4840127ac1ec9af5887ed972a74d9856763f7 (diff)
Enable PIC if only specifying toolchain.
Diffstat (limited to 'xmake/modules/package/tools/cmake.lua')
-rw-r--r--xmake/modules/package/tools/cmake.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index b5b47ced2..d6f882446 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -421,6 +421,10 @@ function _get_configs_for_cross(package, configs, opt)
-- https://github.com/xmake-io/xmake/issues/2170
if not package:is_plat(os.subhost()) then
envs.CMAKE_SYSTEM_NAME = "Linux"
+ else
+ if package:config("pic") ~= false then
+ table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
+ end
end
-- avoid find and add system include/library path
-- @see https://github.com/xmake-io/xmake/issues/2037