Disable warnings for GTest

Warnings for GTest broke the build because GTest turns warnings into
errors, which is undesirable if GTest is just used as a dependency.

See also https://github.com/google/googletest/issues/1373.
This commit is contained in:
heinrich5991 2018-01-05 15:59:06 +01:00
parent 32f919eee0
commit 00154bd280

View file

@ -316,7 +316,10 @@ if(NOT(GTEST_FOUND) AND DOWNLOAD_GTEST)
if(MSVC)
foreach(target gtest)
target_compile_options(${target} PRIVATE $<$<NOT:${DBG}>:/MT> $<${DBG}:/MTd>)
# `/w` disables all warnings. This is needed because `gtest` enables
# `/WX` (equivalent of `-Werror`) for some reason, breaking builds
# when MSVS adds new warnings.
target_compile_options(${target} PRIVATE $<$<NOT:${DBG}>:/MT> $<${DBG}:/MTd> /w)
endforeach()
endif()