summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-09-29 16:10:31 +0800
committerGitHub <[email protected]>2025-09-29 16:10:31 +0800
commita8232d92fc21017e313e42a7aa5593976c6f90d6 (patch)
treed6f7b3c66249d512fd7b25653949816eee20702d
parent2f4d778bcbde53dd6a854f84b9070aee77b7853b (diff)
parentf2ee6986aa2ea45ea71c054600a57182bc19a271 (diff)
Merge pull request #6867 from Redbeanw44602/fix/cmake-generic-configs
Make sure generic options are always inserted.
-rw-r--r--xmake/modules/package/tools/cmake.lua16
1 files changed, 2 insertions, 14 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 2099481bd..9c357772a 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -472,8 +472,6 @@ function _get_configs_for_windows(package, configs, opt)
if package:is_cross() then
_get_configs_for_cross(package, configs, opt)
- else
- _get_configs_for_generic(package, configs, opt)
end
end
@@ -510,7 +508,6 @@ function _get_configs_for_android(package, configs, opt)
table.insert(configs, "-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH")
table.insert(configs, "-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER")
end
- _get_configs_for_generic(package, configs, opt)
end
-- get configs for appleos
@@ -609,7 +606,6 @@ function _get_configs_for_wasm(package, configs, opt)
envs.CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = "BOTH"
envs.CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = "BOTH"
envs.CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "NEVER"
- _get_configs_for_generic(package, configs, opt)
_insert_configs_from_envs(configs, envs, opt)
end
@@ -618,8 +614,6 @@ function _get_configs_for_cross(package, configs, opt)
opt = opt or {}
opt.cross = true
local envs = {}
- envs.CMAKE_BUILD_TYPE = package:is_debug() and "Debug" or "Release"
- envs.BUILD_SHARED_LIBS = package:config("shared") and "ON" or "OFF"
local sdkdir = _translate_paths(package:build_getenv("sdk"))
envs.CMAKE_C_COMPILER = _translate_bin_path(package:build_getenv("cc"))
envs.CMAKE_CXX_COMPILER = _translate_bin_path(package:build_getenv("cxx"))
@@ -655,9 +649,6 @@ function _get_configs_for_cross(package, configs, opt)
envs.CMAKE_SYSTEM_NAME = system_name
envs.CMAKE_SYSTEM_PROCESSOR = _get_cmake_system_processor(package)
end
- if not package:is_plat("windows", "mingw") and package:config("pic") ~= false then
- table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
- end
-- avoid find and add system include/library path
-- @see https://github.com/xmake-io/xmake/issues/2037
-- https://github.com/xmake-io/xmake/issues/6660
@@ -705,9 +696,6 @@ function _get_configs_for_host_toolchain(package, configs, opt)
if package:is_cross() then
envs.CMAKE_SYSTEM_NAME = "Linux"
end
- if not package:is_plat("windows", "mingw") and package:config("pic") ~= false then
- table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
- end
_insert_configs_from_envs(configs, envs, opt)
end
@@ -913,6 +901,8 @@ function _get_configs(package, configs, opt)
opt._configs_str = string.serialize(configs, {indent = false, strip = true})
_get_configs_for_install(package, configs, opt)
_get_configs_for_generator(package, configs, opt)
+ _get_configs_for_generic(package, configs, opt)
+
if package:is_plat("windows") then
_get_configs_for_windows(package, configs, opt)
elseif package:is_plat("android") then
@@ -935,8 +925,6 @@ function _get_configs(package, configs, opt)
else
_get_configs_for_cross(package, configs, opt)
end
- else
- _get_configs_for_generic(package, configs, opt)
end
-- fix error for cmake 4.x