summaryrefslogtreecommitdiff
path: root/xmake/core/package/package.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-07-02 18:37:14 +0800
committerruki <[email protected]>2022-07-02 18:37:14 +0800
commitae59f3feea3998faa9aa65540749176658168b5c (patch)
tree06116eac859cb55b2aab16622c959157fe7adbd6 /xmake/core/package/package.lua
parent2d3649aa6b19c568d807a87775febb497965e0b7 (diff)
add lto to cmake
Diffstat (limited to 'xmake/core/package/package.lua')
-rw-r--r--xmake/core/package/package.lua18
1 files changed, 10 insertions, 8 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index e04d6be0f..a9f39e208 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -1695,14 +1695,16 @@ function _instance:_generate_lto_configs(sourcekind)
-- add cflags
local configs = {}
- local _, cc = self:tool(sourcekind)
- local cflag = sourcekind == "cxx" and "cxxflags" or "cflags"
- if cc == "cl" then
- configs[cflag] = "-GL"
- elseif cc == "clang" or cc == "clangxx" then
- configs[cflag] = "-flto=thin"
- elseif cc == "gcc" or cc == "gxx" then
- configs[cflag] = "-flto"
+ if sourcekind then
+ local _, cc = self:tool(sourcekind)
+ local cflag = sourcekind == "cxx" and "cxxflags" or "cflags"
+ if cc == "cl" then
+ configs[cflag] = "-GL"
+ elseif cc == "clang" or cc == "clangxx" then
+ configs[cflag] = "-flto=thin"
+ elseif cc == "gcc" or cc == "gxx" then
+ configs[cflag] = "-flto"
+ end
end
-- add ldflags and shflags