From 43836ced828362e174fd7ac20c2995312abd2f99 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 22 Aug 2018 17:14:54 +0200 Subject: [PATCH] cmake: add backwards compatibility mode --- templates/CMakeLists.txt.template | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index aec1624acdb..5fff74f128e 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -88,6 +88,7 @@ option(gRPC_BUILD_TESTS "Build tests" OFF) option(gRPC_BUILD_CODEGEN "Build codegen" ON) option(gRPC_BUILD_CSHARP_EXT "Build C# extensions" ON) + option(gRPC_BACKWARDS_COMPATIBILITY_MODE "Build libraries that are binary compatible across a larger number of OS and libc versions" OFF) set(gRPC_INSTALL_default ON) if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) @@ -164,6 +165,14 @@ set(_gRPC_PROTOBUF_LIBRARY_NAME "libprotobuf") endif() + if(gRPC_BACKWARDS_COMPATIBILITY_MODE) + add_definitions(-DGPR_BACKWARDS_COMPATIBILITY_MODE) + if (_gRPC_PLATFORM_MAC) + # CMAKE_OSX_DEPLOYMENT_TARGET + add_definitions(-mmacosx-version-min=10.7) + endif() + endif() + if (_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC) # C core has C++ source code, but should not depend on libstc++ (for better portability). # We need to use a few tricks to convince cmake to do that.