summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-05-03 22:25:05 +0800
committerGitHub <[email protected]>2021-05-03 22:25:05 +0800
commit962f4ae9a36b8ebec84424388fddc6eba2741774 (patch)
tree023c055a14e3220d03aa26defbb4af08de53e6b4
parent3399a6881cad68ef8aa49a1817e96830cc854a6e (diff)
parent20b34bf7cd344c251d05059ed13c6215af77cfd1 (diff)
Merge pull request #1379 from SirLynix/patch-3
Automatically set CMAKE_POSITION_INDEPENDENT_CODE if pic isn't set to false
-rw-r--r--xmake/modules/package/tools/cmake.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index a15812300..b0b92396a 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -225,6 +225,9 @@ function _get_configs_for_generic(package, configs, opt)
if shflags then
table.insert(configs, "-DCMAKE_SHARED_LINKER_FLAGS=" .. shflags)
end
+ if package:config("pic") ~= false then
+ table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
+ end
end
-- get configs for windows