How to use the tool include-what-you-use together with CMake to detect unused headers?

前端 未结 4 1128
滥情空心
滥情空心 2020-12-22 22:59

The tool include-what-you-use can be used to detect unneeded headers. I am using CMake for my C++ software project. How can I instruct CMake to run include-what-you-use auto

4条回答
  •  余生分开走
    2020-12-22 23:36

    You can also enable it globally outside the cmake script by setting the cmake variable:

    cmake -DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="iwyu"  
    

    It will then call it on each CXX target.

提交回复
热议问题