aboutsummaryrefslogtreecommitdiff
path: root/cmake/CMakeLists.txt
diff options
context:
space:
mode:
authorJisi Liu <jisi.liu@gmail.com>2015-06-12 15:49:21 -0700
committerJisi Liu <jisi.liu@gmail.com>2015-06-16 18:27:36 -0700
commit78d470c7a50d3788bf3f819eba99597aea43674f (patch)
treef2d0c53ce1a94234cc4994ea319f1560f44b2f96 /cmake/CMakeLists.txt
parent4cbb612299eaf8259db25f5dcda46022fbd1db54 (diff)
downloadprotobuf-78d470c7a50d3788bf3f819eba99597aea43674f.tar.gz
protobuf-78d470c7a50d3788bf3f819eba99597aea43674f.tar.bz2
protobuf-78d470c7a50d3788bf3f819eba99597aea43674f.zip
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
Diffstat (limited to 'cmake/CMakeLists.txt')
-rw-r--r--cmake/CMakeLists.txt14
1 files changed, 7 insertions, 7 deletions
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})