Permalink
Browse files

Added compile flags for mac

fixed stringstreams for gcc > 4

Signed-off-by: Stephan Vock <stephan.vock@gmail.com>
  • Loading branch information...
1 parent e06d054 commit 5c6b08187096566a706a9c8fd2254e2003152806 @glaubinix glaubinix committed Feb 11, 2012
Showing with 20 additions and 10 deletions.
  1. +13 −6 CMakeLists.txt
  2. +4 −2 client.cpp
  3. +3 −2 client.h
View
@@ -4,7 +4,11 @@ PROJECT(beanstalkpp)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
-INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
+FIND_PACKAGE( Boost 1.48 COMPONENTS system filesystem regex iostreams REQUIRED )
+link_directories(${Boost_LIBRARY_DIR})
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} )
+INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
ADD_LIBRARY(
beanstalkpp SHARED tokenizedstream.cpp serverexception.cpp exception.cpp client.cpp job.cpp
@@ -13,29 +17,32 @@ ADD_LIBRARY(
ADD_EXECUTABLE(
test test.cpp
)
-TARGET_LINK_LIBRARIES(test boost_iostreams boost_system beanstalkpp boost_regex pthread)
+TARGET_LINK_LIBRARIES(test ${Boost_LIBRARIES} beanstalkpp pthread)
ADD_EXECUTABLE(
beansreserve beansreserve.cpp
)
-TARGET_LINK_LIBRARIES(beansreserve boost_iostreams boost_system beanstalkpp boost_regex pthread)
+TARGET_LINK_LIBRARIES(beansreserve ${Boost_LIBRARIES} beanstalkpp pthread)
ADD_EXECUTABLE(
beansput beansput.cpp
)
-TARGET_LINK_LIBRARIES(beansput boost_iostreams boost_system beanstalkpp boost_regex pthread)
+TARGET_LINK_LIBRARIES(beansput ${Boost_LIBRARIES} beanstalkpp pthread)
ADD_EXECUTABLE(
listtubes listtubes.cpp
)
-TARGET_LINK_LIBRARIES(listtubes boost_iostreams boost_system beanstalkpp boost_regex pthread)
+TARGET_LINK_LIBRARIES(listtubes ${Boost_LIBRARIES} beanstalkpp pthread)
ADD_EXECUTABLE(
beanspeek beanspeek.cpp
)
-TARGET_LINK_LIBRARIES(beanspeek boost_iostreams boost_system beanstalkpp boost_regex pthread)
+TARGET_LINK_LIBRARIES(beanspeek ${Boost_LIBRARIES} beanstalkpp pthread)
INSTALL(TARGETS beanstalkpp DESTINATION lib)
+if(APPLE)
+ set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
+endif(APPLE)
INSTALL(DIRECTORY . DESTINATION include/beanstalk++ FILES_MATCHING PATTERN "*.h" PATTERN "beanstalkpp.h" EXCLUDE PATTERN "*~" EXCLUDE PATTERN "*.git*" EXCLUDE PATTERN "*build*" EXCLUDE)
INSTALL(FILES "beanstalkpp.h" DESTINATION include)
View
@@ -126,8 +126,9 @@ bool Beanstalkpp::Client::peekReady(Beanstalkpp::job_p_t& jobPtr) {
job_id_t jobId;
size_t payloadSize;
char *payload;
+ std::stringstream s("peek-ready\r\n");
- this->sendCommand(std::stringstream("peek-ready\r\n"));
+ this->sendCommand(s);
std::string response = this->tokenStream.nextString();
if(response.compare("NOT_FOUND") == 0) {
@@ -197,8 +198,9 @@ size_t Beanstalkpp::Client::watch(const std::string& tube) {
vector< string > Beanstalkpp::Client::listTubes() {
vector<string> ret;
+ stringstream s("list-tubes\r\n");
- this->sendCommand(stringstream("list-tubes\r\n"));
+ this->sendCommand(s);
this->tokenStream.expectString("OK");
size_t payloadSize = this->tokenStream.expectInt();
View
@@ -91,8 +91,9 @@ class Client {
job_id_t jobId;
size_t payloadSize;
char *payload;
-
- this->sendCommand(std::stringstream("reserve\r\n"));
+ std::stringstream s("reserve\r\n");
+
+ this->sendCommand(s);
this->tokenStream.expectString("RESERVED");
jobId = this->tokenStream.expectInt();

0 comments on commit 5c6b081

Please sign in to comment.