using `-isystem` flag

What I want to do:
Disable warnings generated by external libraries while using CMake.

Details:
I’m using cmake to compile my OpenCV project. But OpenCV throws a lot of warnings. When I’m compiling the project from command line by adding -isystem before the OpenCV include path, the warnings get disabled. But I don’t know how to do the same in CMakeLists.txt. Everything I have tried hasn’t worked so far. How do I do it?

That depends on how you use the external Projekt?

If you use variables:

target_include_directories(mytgt SYSTEM PRIVATE ${OpenCV_INCLUDE_DIRS})

If you use targets, it should be done automatically for IMPORTED targets, though CMAKE_NO_SYSTEM_FROM_IMPORTED can change that.