From 2190152114f50bb140f3bb3572264914a32006c1 Mon Sep 17 00:00:00 2001 From: Doekin Date: Sat, 22 Mar 2025 23:06:05 +0800 Subject: package(cmake): fix incorrect flag handling caused by substring matching Resolved an issue where flags were mistakenly considered added due to substring matching (e.g., `CMAKE_CXX_FLAGS` being a part of `CMAKE_CXX_FLAGS_RELWITHDEBINFO`). This prevented certain flags from being properly included in the cmake command line. Improved the logic to ensure accurate flag detection and inclusion. --- xmake/modules/package/tools/cmake.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index fab2d0ff4..c0f86a95e 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -390,7 +390,7 @@ function _insert_configs_from_envs(configs, envs, opt) opt = opt or {} local configs_str = opt._configs_str for k, v in pairs(envs) do - if configs_str and configs_str:find(k, 1, true) then + if configs_str and configs_str:find("-D" .. k .. "=", 1, true) then -- use user custom configuration else table.insert(configs, "-D" .. k .. "=" .. v) -- cgit v1.3.1