From 78d470c7a50d3788bf3f819eba99597aea43674f Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Fri, 12 Jun 2015 15:49:21 -0700 Subject: Make the code independent of config.h Now the Build tool needs to define -DHAVE_ZLIB and -DHAVE-PTHREAD rather than providing a config.h - Make pbconfig.h a manually written file to handle hash conditions according to platform related macros. - Remove #include "config.h" from source code. - Changed the configure.ac and Makefile.am to pass down the macros. - Change cmake to pass down the the macros. Change-Id: I537249d5df8fdeba189706aec436d1ab1104a4dc --- cmake/CMakeLists.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'cmake/CMakeLists.txt') diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 727864ba..d36292df 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -8,11 +8,11 @@ if (MSVC) option(ZLIB "Build with zlib support" OFF) endif (MSVC) +add_definitions(-DGOOGLE_PROTOBUF_CMAKE_BUILD) + find_package(Threads REQUIRED) if (CMAKE_USE_PTHREADS_INIT) - set(HAVE_PTHREAD 1) -else (CMAKE_USE_PTHREADS_INIT) - set(HAVE_PTHREAD 0) + add_definitions(-DHAVE_PTHREAD) endif (CMAKE_USE_PTHREADS_INIT) if (MSVC) @@ -36,6 +36,10 @@ else (MSVC) endif (ZLIB_FOUND) endif (MSVC) +if (HAVE_ZLIB) + add_definitions(-DHAVE_ZLIB) +endif (HAVE_ZLIB) + if (MSVC) if (BUILD_SHARED_LIBS) add_definitions(-DPROTOBUF_USE_DLLS) @@ -43,10 +47,6 @@ if (MSVC) add_definitions(/wd4244 /wd4267 /wd4018 /wd4355 /wd4800 /wd4251 /wd4996 /wd4146 /wd4305) endif (MSVC) -include(find_hash_map.cmake) - -configure_file(config.h.in config.h) -configure_file(pbconfig.h.in google/protobuf/stubs/pbconfig.h) if (MSVC) string(REPLACE "/" "\\" PROTOBUF_SOURCE_WIN32_PATH ${protobuf_SOURCE_DIR}) string(REPLACE "/" "\\" PROTOBUF_BINARY_WIN32_PATH ${protobuf_BINARY_DIR}) -- cgit v1.2.3