Search code examples
premake

Disable all warnings for specific file with premake5


How can I instruct premake5 to disable all warnings from a specific file?

filter "files:my_file.c"
    warnings "Off"

does not seem to work.


Solution

  • Try:

    disablewarnings { "warning" }
    

    Where warning is either the number or name of the compiler warning to disable.

    From:

    https://github.com/premake/premake-core/wiki/disablewarnings

    [UPDATE]

    If, however, it is a linker warning you want to suppress, then try this:

    linkoptions { "-IGNORE:4221" }
    

    Or whatever linker warning number you want to disable.

    https://github.com/premake/premake-core/wiki/linkoptions

    UPDATE: (2019.04.02) Corrected linkoption to linkoptions (Thanks @yuyoyuppe)