From f231b4450cdac437aaf3324503d85cb8325f8d6a Mon Sep 17 00:00:00 2001 From: Jim King Date: Mon, 13 Apr 2015 12:25:35 -0400 Subject: [PATCH] THRIFT-3094 fix broken cmake build of C++ library with alternate threading --- build/cmake/DefinePlatformSpecifc.cmake | 12 +++++++++++- lib/cpp/CMakeLists.txt | 2 -- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/build/cmake/DefinePlatformSpecifc.cmake b/build/cmake/DefinePlatformSpecifc.cmake index 282cad30028..bafbf49e014 100644 --- a/build/cmake/DefinePlatformSpecifc.cmake +++ b/build/cmake/DefinePlatformSpecifc.cmake @@ -56,7 +56,17 @@ if(MSVC) else(WITH_MT) set(STATIC_POSTFIX "md" CACHE STRING "Set static library postfix" FORCE) endif(WITH_MT) -endif(MSVC) + +elseif(UNIX) + # For UNIX + # WITH_*THREADS selects which threading library to use + if(WITH_BOOSTTHREADS) + add_definitions("-DUSE_BOOST_THREAD=1") + elseif(WITH_STDTHREADS) + add_definitions("-DUSE_STD_THREAD=1") + endif() + +endif() # GCC Specific if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) diff --git a/lib/cpp/CMakeLists.txt b/lib/cpp/CMakeLists.txt index 4c73986e047..9075c560d3b 100755 --- a/lib/cpp/CMakeLists.txt +++ b/lib/cpp/CMakeLists.txt @@ -104,7 +104,6 @@ endif() # WITH_*THREADS selects which threading library to use if(WITH_BOOSTTHREADS) - add_definitions("-DUSE_BOOST_THREAD=1") set( thriftcpp_threads_SOURCES src/thrift/concurrency/BoostThreadFactory.cpp src/thrift/concurrency/BoostMonitor.cpp @@ -119,7 +118,6 @@ elseif(UNIX AND NOT WITH_STDTHREADS) src/thrift/concurrency/Monitor.cpp ) else() - add_definitions("-DUSE_STD_THREAD=1") if(UNIX) # need pthread for multi-thread support list(APPEND SYSLIBS pthread)