diff options
| author | ruki <[email protected]> | 2024-06-15 23:49:49 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-06-15 23:49:49 +0800 |
| commit | 95a78af703f2709285b5a51c151bbf0d23817e52 (patch) | |
| tree | cdfd92364fbf047daaf52557f9922bfe849e4d7e | |
| parent | c72c18a4acc057a551a35a4e2fe29fc50c2af2b3 (diff) | |
ignore some builtin defines #5217
| -rw-r--r-- | xmake/modules/package/manager/cmake/find_package.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/xmake/modules/package/manager/cmake/find_package.lua b/xmake/modules/package/manager/cmake/find_package.lua index b9e4977ef..48063b5dd 100644 --- a/xmake/modules/package/manager/cmake/find_package.lua +++ b/xmake/modules/package/manager/cmake/find_package.lua @@ -20,6 +20,7 @@ -- imports import("core.base.option") +import("core.base.hashset") import("core.project.target") import("lib.detect.find_tool") @@ -258,8 +259,19 @@ function _find_package(cmake, name, opt) values = line:match("<PreprocessorDefinitions>%%%(PreprocessorDefinitions%);(.+)</PreprocessorDefinitions>") if values then + -- https://github.com/xmake-io/xmake/issues/5217 + local excludes = hashset.from { + "NDEBUG", "_DEBUG", "CMAKE_INTDIR", "WIN32", + "_WINDOWS", "USE_DISTRIBUTED", "USE_C10D_GLOO" + } defines = defines or {} - table.join2(defines, path.splitenv(values)) + values = path.splitenv(values) + for _, value in ipairs(values) do + local name = value:split("=")[1] + if not excludes:has(name) then + table.insert(defines, value) + end + end end end end |
