Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions xmake/modules/package/tools/cmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,10 @@ function _get_configs(package, configs, opt)
_get_configs_for_generic(package, configs, opt)
end

if not opt._configs_str:find("CMAKE_INTERPROCEDURAL_OPTIMIZATION", 1, true) then
table.insert(configs, "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF")
Copy link
Member

@waruqi waruqi Apr 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这怎么看着有点 hack, 依赖特定包中对 CMAKE_INTERPROCEDURAL_OPTIMIZATION defined 的判断。

确定所有包和 cmake 内部都是defined 这种形式来判断?永远不会出现 if(NOT CMAKE_INTERPROCEDURAL_OPTIMIZATION)?

if(NOT DEFINED CMAKE_INTERPROCEDURAL_OPTIMIZATION)
  set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
endif()

在没这个上下文背景下,单看这个 patch ,字面上跟 lto flags 设置状态,很不搭。

要么开头加点注释详细说明下情况,否则我怕 过上一阵子,就看不懂了

end

-- fix error for cmake 4.x
-- e.g. Compatibility with CMake < 3.5 has been removed from CMake.
if _get_cmake_version() and _get_cmake_version():ge("4.0") then
Expand Down
Loading