diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index 02943124c..57b43fa7c 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -13,7 +13,9 @@ if(APPLE) endif() endif() -check_cxx_compiler_flag("-Wno-redundant-move" HAS_NO_REDUNDANT_MOVE) +# An unrecognized flag is usually a warning and not an error, which CMake apparently does +# not pick up on. Combine it with -Werror to determine if it's actually supported. +check_cxx_compiler_flag("-Wno-redundant-move -Werror" HAS_NO_REDUNDANT_MOVE) if (HAS_NO_REDUNDANT_MOVE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-redundant-move") endif()