From 4fd8c94df01468df328d428b7a1197cc4917fb1c Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Wed, 11 Jun 2014 01:24:34 +0200 Subject: [PATCH] Overhaul common's CMakeLists.txt * Use automoc instead of a manual list of headers * Remove Qt4 detection * Created missing .cpp for .h files (for automoc detection) * Remove pthread linking * Forcing -lprotobuf is not needed for mingw; msvc only? --- common/CMakeLists.txt | 28 ++++------------------------ common/pb/CMakeLists.txt | 5 ++--- common/server_arrowtarget.cpp | 2 ++ common/server_database_interface.cpp | 2 ++ 4 files changed, 10 insertions(+), 27 deletions(-) create mode 100644 common/server_arrowtarget.cpp create mode 100644 common/server_database_interface.cpp diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 17d3fa46..e43c240a 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -9,10 +9,12 @@ SET(common_SOURCES server.cpp server_abstractuserinterface.cpp server_arrow.cpp + server_arrowtarget.h server_card.cpp server_cardzone.cpp server_counter.cpp server_game.cpp + server_database_interface.cpp server_player.cpp server_protocolhandler.cpp server_remoteuserinterface.cpp @@ -21,34 +23,12 @@ SET(common_SOURCES serverinfo_user_container.cpp sfmt/SFMT.c ) -SET(common_HEADERS - decklist.h - rng_abstract.h - rng_sfmt.h - server.h - server_arrowtarget.h - server_card.h - server_database_interface.h - server_game.h - server_player.h - server_protocolhandler.h - server_room.h -) -FIND_PACKAGE(Qt4 REQUIRED) -FIND_PACKAGE(Protobuf REQUIRED) - -QT4_WRAP_CPP(common_HEADERS_MOC ${common_HEADERS}) INCLUDE(${QT_USE_FILE}) INCLUDE_DIRECTORIES(pb) INCLUDE_DIRECTORIES(sfmt) INCLUDE_DIRECTORIES(${PROTOBUF_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) -add_library(cockatrice_common ${common_SOURCES} ${common_HEADERS_MOC}) -# Without this check, Linux will put -pthread out of order in link.txt and build will fail -if (UNIX) - target_link_libraries(cockatrice_common cockatrice_protocol pthread) -else (UNIX) - target_link_libraries(cockatrice_common cockatrice_protocol) -endif (UNIX) +add_library(cockatrice_common ${common_SOURCES} ${common_MOC_SRCS}) +target_link_libraries(cockatrice_common cockatrice_protocol) diff --git a/common/pb/CMakeLists.txt b/common/pb/CMakeLists.txt index e109a58b..b654443e 100644 --- a/common/pb/CMakeLists.txt +++ b/common/pb/CMakeLists.txt @@ -144,14 +144,13 @@ SET(PROTO_FILES session_event.proto ) -find_package(Protobuf REQUIRED) include_directories(${PROTOBUF_INCLUDE_DIRS}) include_directories(${CMAKE_CURRENT_BINARY_DIR}) PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${PROTO_FILES}) add_library(cockatrice_protocol ${PROTO_SRCS} ${PROTO_HDRS}) set(cockatrice_protocol_LIBS ${PROTOBUF_LIBRARIES}) -if (WIN32) +if (MSVC) set(cockatrice_protocol_LIBS ${cockatrice_protocol_LIBS} -lprotobuf) -endif (WIN32) +endif (MSVC) target_link_libraries(cockatrice_protocol ${cockatrice_protocol_LIBS}) diff --git a/common/server_arrowtarget.cpp b/common/server_arrowtarget.cpp new file mode 100644 index 00000000..aa7789dd --- /dev/null +++ b/common/server_arrowtarget.cpp @@ -0,0 +1,2 @@ + +#include "server_arrowtarget.h" \ No newline at end of file diff --git a/common/server_database_interface.cpp b/common/server_database_interface.cpp new file mode 100644 index 00000000..a375f603 --- /dev/null +++ b/common/server_database_interface.cpp @@ -0,0 +1,2 @@ + +#include "server_database_interface.h"