From e0158c04bf37ff034cd4b6d6ed93c20bba9fd352 Mon Sep 17 00:00:00 2001 From: Denver Coneybeare Date: Wed, 4 Sep 2024 13:37:43 -0400 Subject: [PATCH] Add `-Wno-error=redundant-move` to cmake builds (#13582) --- cmake/compiler_setup.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmake/compiler_setup.cmake b/cmake/compiler_setup.cmake index 53c13d5576f..f214c55ca66 100644 --- a/cmake/compiler_setup.cmake +++ b/cmake/compiler_setup.cmake @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +include(CheckCXXCompilerFlag) + # C++ Compiler setup # We use C++14 @@ -76,6 +78,14 @@ if(CXX_CLANG OR CXX_GNU) list(APPEND common_flags -fdiagnostics-color) endif() endif() + + # Disable treating "redundant-move" as an error since it's not really a problem, + # and is even a valid coding style to over-use std::move() in case the type is + # ever changed to become non-trivially moveable. + CHECK_CXX_COMPILER_FLAG("-Wno-error=redundant-move" FIREBASE_CXX_COMPILER_FLAG_REDUNDANT_MOVE_SUPPORTED) + if(FIREBASE_CXX_COMPILER_FLAG_REDUNDANT_MOVE_SUPPORTED) + list(APPEND common_flags -Wno-error=redundant-move) + endif() endif() if(APPLE)