diff options
| author | ruki <[email protected]> | 2022-06-19 21:38:58 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-06-19 21:38:58 +0800 |
| commit | d43525ea44aeebe87068817549b2b9dbdb43c47b (patch) | |
| tree | e74d4a8645ce147b09a97f0e1bc8ef5c9b0a7c43 /xmake/modules/core/tools/cl.lua | |
| parent | e3b3ffbc6230e9dee45a38356095705f9705966f (diff) | |
add build.warning policy
Diffstat (limited to 'xmake/modules/core/tools/cl.lua')
| -rw-r--r-- | xmake/modules/core/tools/cl.lua | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua index d736c0ad2..703250c8b 100644 --- a/xmake/modules/core/tools/cl.lua +++ b/xmake/modules/core/tools/cl.lua @@ -366,6 +366,22 @@ function _compargv_pch(self, pcheaderfile, pcoutputfile, flags) return self:program(), table.join("-c", "-Yc", pchflags, "-Fp" .. pcoutputfile, "-Fo" .. pcoutputfile .. ".obj", pcheaderfile) end +-- has warnings output? +function _has_warnings() + local warnings = _g.warnings + if warnings == nil then + warnings = option.get("diagnosis") or option.get("warning") + if warnings == nil and os.isfile(os.projectfile()) and project.policy("build.warning") ~= nil then + warnings = project.policy("build.warning") + end + if warnings == nil then + warnings = global.get("build_warning") + end + _g.warnings = warnings or false + end + return warnings +end + -- has /sourceDependencies xxx.json @see https://github.com/xmake-io/xmake/issues/868? function _has_source_dependencies(self) local has_source_dependencies = _g._HAS_SOURCE_DEPENDENCIES @@ -616,7 +632,7 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt) function (ok, outdata, errdata) -- show warnings? - if ok and (option.get("diagnosis") or option.get("warning") or global.get("build_warning")) then + if ok and _has_warnings() then local output = outdata or "" if #output:trim() == 0 then output = errdata or "" |
