From 4aebd62cdd94d8a11e5c43549c8b47ae3075bbef Mon Sep 17 00:00:00 2001 From: HanzZ Date: Thu, 20 Oct 2011 15:42:48 +0200 Subject: [PATCH] fix networkplugin compilation on windows --- plugin/src/CMakeLists.txt | 11 ++++++++++- plugin/src/networkplugin.cpp | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/plugin/src/CMakeLists.txt b/plugin/src/CMakeLists.txt index f432ff6c..16a2a3ea 100644 --- a/plugin/src/CMakeLists.txt +++ b/plugin/src/CMakeLists.txt @@ -5,7 +5,16 @@ FILE(GLOB HEADERS ../include/transport/*.h) ADD_LIBRARY(transport-plugin SHARED ${HEADERS} ${SRC} ${PROTOBUF_SRC} ${PROTOBUF_HDRS} ../../src/memoryusage.cpp ${CMAKE_CURRENT_BINARY_DIR}/../../include/transport/protocol.pb.cc) ADD_DEPENDENCIES(transport-plugin pb) SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/../../include/transport/protocol.pb.cc PROPERTIES GENERATED 1) -ADD_DEFINITIONS(-fPIC) + +if (CMAKE_COMPILER_IS_GNUCXX) + ADD_DEFINITIONS(-fPIC) +endif() + +if (NOT WIN32) + TARGET_LINK_LIBRARIES(transport-plugin ${PROTOBUF_LIBRARIES} ${LOG4CXX_LIBRARIES}) +else() + TARGET_LINK_LIBRARIES(transport-plugin ${PROTOBUF_LIBRARIES} ${LOG4CXX_LIBRARIES} ws2_32.lib) +endif() TARGET_LINK_LIBRARIES(transport-plugin ${PROTOBUF_LIBRARIES} ${LOG4CXX_LIBRARIES}) diff --git a/plugin/src/networkplugin.cpp b/plugin/src/networkplugin.cpp index 9b08d72d..82aa3bb4 100644 --- a/plugin/src/networkplugin.cpp +++ b/plugin/src/networkplugin.cpp @@ -23,7 +23,11 @@ #include "log4cxx/basicconfigurator.h" #include "transport/memoryusage.h" +#ifndef WIN32 #include +#else +#include +#endif using namespace log4cxx;