From 1b88d13e75db401c72ad0709170175094f9878ee Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 31 Dec 2013 09:05:52 +0100 Subject: [PATCH] fixing library dependencies and include paths --- CMakeLists.txt | 8 +++---- core/src/CMakeLists.txt | 39 ++++++++++++++------------------ core/src/bindings/CMakeLists.txt | 18 ++++----------- src/CMakeLists.txt | 9 +------- 4 files changed, 26 insertions(+), 48 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 23c5418eb..dd7a8de61 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,10 +33,10 @@ find_package (Curses REQUIRED) find_package (Lua REQUIRED) find_package (ToLua REQUIRED) -add_subdirectory (src server) -add_subdirectory (crypto) -add_subdirectory (quicklist) -add_subdirectory (iniparser) add_subdirectory (cutest) +add_subdirectory (crypto) +add_subdirectory (iniparser) +add_subdirectory (quicklist) add_subdirectory (critbit) add_subdirectory (core/src eressea) +add_subdirectory (src server) diff --git a/core/src/CMakeLists.txt b/core/src/CMakeLists.txt index a89f42175..f1c6f73a0 100755 --- a/core/src/CMakeLists.txt +++ b/core/src/CMakeLists.txt @@ -6,23 +6,8 @@ IF(CMAKE_COMPILER_IS_GNUCC) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") ENDIF(CMAKE_COMPILER_IS_GNUCC) -set (ERESSEA_LIBRARY ${PROJECT_NAME} CACHE INTERNAL "Eressea Core Library") -set (ERESSEA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "Eressea Core headers") - -add_subdirectory(bindings) - -set (ERESSEA_LIBRARIES - ${CUTEST_LIBRARIES} - ${CRITBIT_LIBRARIES} - ${QUICKLIST_LIBRARIES} - ${CRYPTO_LIBRARIES} - ${INIPARSER_LIBRARIES} - ${LUA_LIBRARIES} - ${LIBXML2_LIBRARIES} - ${SQLITE3_LIBRARIES} - ${CURSES_LIBRARIES} - CACHE STRING "Eressea Libraries" -) +set (ERESSEA_LIBRARY eressea CACHE INTERNAL "eressea library") +set (ERESSEA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "eressea includes") include_directories (${ERESSEA_INCLUDE_DIR}) include_directories (${CRITBIT_INCLUDE_DIR}) @@ -30,7 +15,6 @@ include_directories (${CRYPTO_INCLUDE_DIR}) include_directories (${QUICKLIST_INCLUDE_DIR}) include_directories (${CUTEST_INCLUDE_DIR}) include_directories (${LUA_INCLUDE_DIR}) -include_directories (${TOLUA_INCLUDE_DIR}) include_directories (${LIBXML2_INCLUDE_DIR}) include_directories (${INIPARSER_INCLUDE_DIR}) @@ -199,15 +183,26 @@ set (LIB_SRC ) add_library(${ERESSEA_LIBRARY} ${LIB_SRC} ${BIND_SRC} ${LIB_HDR}) -target_link_libraries(${ERESSEA_LIBRARY} ${ERESSEA_LIBRARIES}) +target_link_libraries(${ERESSEA_LIBRARY} + ${CRITBIT_LIBRARIES} + ${QUICKLIST_LIBRARIES} + ${CRYPTO_LIBRARIES} + ${INIPARSER_LIBRARIES} + ${LIBXML2_LIBRARIES} + ${SQLITE3_LIBRARIES} + ${CURSES_LIBRARIES} + ${LUA_LIBRARIES} +) -add_executable(${PROJECT_NAME}_test ${TEST_SRC}) -target_link_libraries(${PROJECT_NAME}_test ${ERESSEA_LIBRARY}) +add_executable(test_eressea ${TEST_SRC}) +target_link_libraries(test_eressea ${ERESSEA_LIBRARY}) +target_link_libraries(test_eressea ${CUTEST_LIBRARIES}) -add_test(${PROJECT_NAME} ${PROJECT_NAME}_test) +add_test(eressea test_eressea) IF (MSVC) find_package (MSVC MODULE) MSVC_CRT_SECURE_NO_WARNINGS (${ERESSEA_LIBRARY}) ENDIF (MSVC) +add_subdirectory(bindings) diff --git a/core/src/bindings/CMakeLists.txt b/core/src/bindings/CMakeLists.txt index 9a080fd95..c3d6b4db0 100755 --- a/core/src/bindings/CMakeLists.txt +++ b/core/src/bindings/CMakeLists.txt @@ -13,17 +13,9 @@ set (BINDINGS_LIBRARY ${PROJECT_NAME} CACHE INTERNAL "Eressea Lua Bindings") find_package (Lua 5 REQUIRED) find_package (ToLua REQUIRED) -include_directories (${ERESSEA_INCLUDE_DIR}) -include_directories (${CRITBIT_INCLUDE_DIR}) -include_directories (${CRYPTO_INCLUDE_DIR}) -include_directories (${QUICKLIST_INCLUDE_DIR}) -include_directories (${CUTEST_INCLUDE_DIR}) -include_directories (${LUA_INCLUDE_DIR}) include_directories (${TOLUA_INCLUDE_DIR}) -include_directories (${LIBXML2_INCLUDE_DIR}) -include_directories (${INIPARSER_INCLUDE_DIR}) -FILE (GLOB_RECURSE LIB_HDR *.h) +FILE (GLOB_RECURSE BINDINGS_HDR *.h) MACRO(ADD_LUA_MODULE MODULE_NAME FILES) ADD_LIBRARY (${MODULE_NAME} SHARED ${FILES}) @@ -47,16 +39,13 @@ TOLUA_BINDING(process.pkg bind_process.h) TOLUA_BINDING(eressea.pkg bind_eressea.h) TOLUA_BINDING(settings.pkg bind_settings.h) -set (BIND_SRC +set (BINDINGS_SRC process.pkg.c eressea.pkg.c settings.pkg.c - bind_process.c bind_eressea.c bind_settings.c - -# bind_attrib.c bind_building.c bind_faction.c bind_gmtool.c @@ -71,5 +60,6 @@ set (BIND_SRC helpers.c ) -add_library(${BINDINGS_LIBRARY} ${LIB_SRC} ${BIND_SRC} ${LIB_HDR}) +add_library(${BINDINGS_LIBRARY} ${BINDINGS_SRC} ${BINDINGS_HDR}) +target_link_libraries(${BINDINGS_LIBRARY} ${TOLUA_LIBRARIES}) target_link_libraries(${BINDINGS_LIBRARY} ${ERESSEA_LIBRARY}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a3f93c27c..a1cdae203 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,11 +39,4 @@ set (SERVER_SRC ) add_executable(server ${SERVER_SRC}) -target_link_libraries(server - ${ERESSEA_LIBRARY} - ${BINDINGS_LIBRARY} - ${TOLUA_LIBRARIES} - ${LUA_LIBRARIES} - ${SQLITE3_LIBRARIES} - ${CURSES_LIBRARIES} -) +target_link_libraries(server ${BINDINGS_LIBRARY})