I'm building Googletest as a dependency of my code. Unfortunately Googletest requires very old versions of CMake, which triggers a lot of deprecation warning. I'd like to get rid of them.
I can successfully hide the warnings through command line flags like these:
cmake -Wno-deprecated ..
cmake -DCMAKE_WARN_DEPRECATED=OFF ..
However, I'd prefer to have that set inside the CMakeLists.txt. But I'm not sure how to specify that. The following two commands didn't help:
set(CMAKE_WARN_DEPRECATED OFF)
set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL)
Any ideas? Also, is there maybe a way to have that setting for a limited scope, like e.g. one subdirectory?
Found it out. A little extra flag did the trick:
set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE)
Not sure though if that's the recommended way to go.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With