From 8028bad7b1f13dde30231a932d459bb0cda17b0b Mon Sep 17 00:00:00 2001 From: ebbit1q Date: Fri, 9 Nov 2018 11:05:11 +0100 Subject: [PATCH] set common protobuf files to compile with other tags in debug (#3432) * set common protobuf files to compile with other tags in debug force the same flags as release on debug builds fixes #3431 * check for version first * use Protobuf_VERSION instead of calling protoc --version * lower verion requirement * set tags to disable certain warnings instead of removing all --- common/pb/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/pb/CMakeLists.txt b/common/pb/CMakeLists.txt index 889bc769..7be8edba 100644 --- a/common/pb/CMakeLists.txt +++ b/common/pb/CMakeLists.txt @@ -168,3 +168,12 @@ if (UNIX) set(cockatrice_protocol_LIBS ${cockatrice_protocol_LIBS} -lpthread) endif (UNIX) target_link_libraries(cockatrice_protocol ${cockatrice_protocol_LIBS}) + +# ubuntu uses an outdated package for protobuf, 3.1.0 is required +if(${Protobuf_VERSION} VERSION_LESS "3.1.0") + # remove unused parameter and misleading indentation warnings when compiling to avoid errors + set(CMAKE_CXX_FLAGS_DEBUG + "${CMAKE_CXX_FLAGS_DEBUG} -Wno-unused-parameter -Wno-misleading-indentation") + message(WARNING "Outdated protobuf version found (${Protobuf_VERSION} < 3.1.0), " + "disabled warnings to avoid compilation errors.") +endif()