summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorJim King <jim.king@simplivity.com>2015-04-30 16:03:34 -0400
committerRoger Meier <roger@apache.org>2015-04-30 22:40:26 +0200
commit9de9b1f1be7b343e8493560b6eb540a948303f6f (patch)
treef713d9cd39d10a840bd14574ca08fbf586815b89 /build
parent1a8e048bd05b8506ab06200282e2ba516927786e (diff)
downloadthrift-9de9b1f1be7b343e8493560b6eb540a948303f6f.tar.gz
THRIFT-2850 get windows cmake working again and building the unit tests for lib/cpp, and pass make check through cmake - also resolve some compiler warnings
Diffstat (limited to 'build')
-rw-r--r--build/cmake/ConfigureChecks.cmake1
-rw-r--r--build/cmake/DefineOptions.cmake5
-rw-r--r--build/cmake/DefinePlatformSpecifc.cmake15
-rw-r--r--build/cmake/ThriftMacros.cmake31
4 files changed, 47 insertions, 5 deletions
diff --git a/build/cmake/ConfigureChecks.cmake b/build/cmake/ConfigureChecks.cmake
index e2c904338..f65054401 100644
--- a/build/cmake/ConfigureChecks.cmake
+++ b/build/cmake/ConfigureChecks.cmake
@@ -31,6 +31,7 @@ endif(NOT HAVE_AI_ADDRCONFIG)
check_include_file(arpa/inet.h HAVE_ARPA_INET_H)
check_include_file(fcntl.h HAVE_FCNTL_H)
+check_include_file(getopt.h HAVE_GETOPT_H)
check_include_file(inttypes.h HAVE_INTTYPES_H)
check_include_file(netdb.h HAVE_NETDB_H)
check_include_file(netinet/in.h HAVE_NETINET_IN_H)
diff --git a/build/cmake/DefineOptions.cmake b/build/cmake/DefineOptions.cmake
index d5880de0e..adedcc807 100644
--- a/build/cmake/DefineOptions.cmake
+++ b/build/cmake/DefineOptions.cmake
@@ -86,12 +86,15 @@ CMAKE_DEPENDENT_OPTION(BUILD_PYTHON "Build Python library" ON
# Common library options
option(WITH_SHARED_LIB "Build shared libraries" ON)
option(WITH_STATIC_LIB "Build static libraries" ON)
+if (NOT WITH_SHARED_LIB AND NOT WITH_STATIC_LIB)
+ message(FATAL_ERROR "Cannot build with both shared and static outputs disabled!")
+endif()
#NOTE: C++ compiler options are defined in the lib/cpp/CMakeLists.txt
# Visual Studio only options
if(MSVC)
-option(WITH_MT "Build unsing MT instead of MT (MSVC only)" OFF)
+option(WITH_MT "Build using MT instead of MD (MSVC only)" OFF)
endif(MSVC)
macro(MESSAGE_DEP flag summary)
diff --git a/build/cmake/DefinePlatformSpecifc.cmake b/build/cmake/DefinePlatformSpecifc.cmake
index 63e78f4f9..07272ce1a 100644
--- a/build/cmake/DefinePlatformSpecifc.cmake
+++ b/build/cmake/DefinePlatformSpecifc.cmake
@@ -22,7 +22,7 @@
if(MSVC)
#For visual studio the library naming is as following:
# Dynamic libraries:
- # - thfirt.dll for release library
+ # - thrift.dll for release library
# - thriftd.dll for debug library
#
# Static libraries:
@@ -38,7 +38,6 @@ if(MSVC)
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set debug library postfix" FORCE)
set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "Set release library postfix" FORCE)
-
# Build using /MT option instead of /MD if the WITH_MT options is set
if(WITH_MT)
set(CompilerFlags
@@ -57,6 +56,18 @@ if(MSVC)
set(STATIC_POSTFIX "md" CACHE STRING "Set static library postfix" FORCE)
endif(WITH_MT)
+ # Disable Windows.h definition of macros for min and max
+ add_definitions("-DNOMINMAX")
+
+ # Disable boost auto linking pragmas - cmake includes the right files
+ add_definitions("-DBOOST_ALL_NO_LIB")
+
+ # Windows build does not know how to make a shared library yet
+ # as there are no __declspec(dllexport) or exports files in the project.
+ if (WITH_SHARED_LIB)
+ message (FATAL_ERROR "Windows build does not support shared library output yet!")
+ endif()
+
elseif(UNIX)
# For UNIX
# WITH_*THREADS selects which threading library to use
diff --git a/build/cmake/ThriftMacros.cmake b/build/cmake/ThriftMacros.cmake
index d35ec1085..265659814 100644
--- a/build/cmake/ThriftMacros.cmake
+++ b/build/cmake/ThriftMacros.cmake
@@ -52,7 +52,8 @@ if(WITH_STATIC_LIB)
PUBLIC_HEADER DESTINATION "${INCLUDE_INSTALL_DIR}")
endif()
-endmacro()
+endmacro(ADD_LIBRARY_THRIFT)
+
macro(TARGET_LINK_LIBRARIES_THRIFT name)
@@ -64,4 +65,30 @@ if(WITH_STATIC_LIB)
target_link_libraries(${name}_static ${ARGN})
endif()
-endmacro() \ No newline at end of file
+endmacro(TARGET_LINK_LIBRARIES_THRIFT)
+
+
+macro(LINK_AGAINST_THRIFT_LIBRARY target libname)
+
+if (WITH_SHARED_LIB)
+ target_link_libraries(${target} ${libname})
+elseif (WITH_STATIC_LIB)
+ target_link_libraries(${target} ${libname}_static)
+else()
+ message(FATAL "Not linking with shared or static libraries?")
+endif()
+
+endmacro(LINK_AGAINST_THRIFT_LIBRARY)
+
+
+macro(TARGET_LINK_LIBRARIES_THRIFT_AGAINST_THRIFT_LIBRARY target libname)
+
+if(WITH_SHARED_LIB)
+ target_link_libraries(${target} ${libname})
+endif()
+
+if(WITH_STATIC_LIB)
+ target_link_libraries(${target}_static ${libname}_static)
+endif()
+
+endmacro(TARGET_LINK_LIBRARIES_THRIFT_AGAINST_THRIFT_LIBRARY)