fixing library dependencies and include paths

This commit is contained in:
Enno Rehling 2013-12-31 09:05:52 +01:00
parent 0e20e14bf9
commit 1b88d13e75
4 changed files with 26 additions and 48 deletions

View File

@ -33,10 +33,10 @@ find_package (Curses REQUIRED)
find_package (Lua REQUIRED) find_package (Lua REQUIRED)
find_package (ToLua REQUIRED) find_package (ToLua REQUIRED)
add_subdirectory (src server)
add_subdirectory (crypto)
add_subdirectory (quicklist)
add_subdirectory (iniparser)
add_subdirectory (cutest) add_subdirectory (cutest)
add_subdirectory (crypto)
add_subdirectory (iniparser)
add_subdirectory (quicklist)
add_subdirectory (critbit) add_subdirectory (critbit)
add_subdirectory (core/src eressea) add_subdirectory (core/src eressea)
add_subdirectory (src server)

View File

@ -6,23 +6,8 @@ IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
ENDIF(CMAKE_COMPILER_IS_GNUCC) ENDIF(CMAKE_COMPILER_IS_GNUCC)
set (ERESSEA_LIBRARY ${PROJECT_NAME} CACHE INTERNAL "Eressea Core Library") set (ERESSEA_LIBRARY eressea CACHE INTERNAL "eressea library")
set (ERESSEA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "Eressea Core headers") set (ERESSEA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "eressea includes")
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"
)
include_directories (${ERESSEA_INCLUDE_DIR}) include_directories (${ERESSEA_INCLUDE_DIR})
include_directories (${CRITBIT_INCLUDE_DIR}) include_directories (${CRITBIT_INCLUDE_DIR})
@ -30,7 +15,6 @@ include_directories (${CRYPTO_INCLUDE_DIR})
include_directories (${QUICKLIST_INCLUDE_DIR}) include_directories (${QUICKLIST_INCLUDE_DIR})
include_directories (${CUTEST_INCLUDE_DIR}) include_directories (${CUTEST_INCLUDE_DIR})
include_directories (${LUA_INCLUDE_DIR}) include_directories (${LUA_INCLUDE_DIR})
include_directories (${TOLUA_INCLUDE_DIR})
include_directories (${LIBXML2_INCLUDE_DIR}) include_directories (${LIBXML2_INCLUDE_DIR})
include_directories (${INIPARSER_INCLUDE_DIR}) include_directories (${INIPARSER_INCLUDE_DIR})
@ -199,15 +183,26 @@ set (LIB_SRC
) )
add_library(${ERESSEA_LIBRARY} ${LIB_SRC} ${BIND_SRC} ${LIB_HDR}) 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}) add_executable(test_eressea ${TEST_SRC})
target_link_libraries(${PROJECT_NAME}_test ${ERESSEA_LIBRARY}) 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) IF (MSVC)
find_package (MSVC MODULE) find_package (MSVC MODULE)
MSVC_CRT_SECURE_NO_WARNINGS (${ERESSEA_LIBRARY}) MSVC_CRT_SECURE_NO_WARNINGS (${ERESSEA_LIBRARY})
ENDIF (MSVC) ENDIF (MSVC)
add_subdirectory(bindings)

View File

@ -13,17 +13,9 @@ set (BINDINGS_LIBRARY ${PROJECT_NAME} CACHE INTERNAL "Eressea Lua Bindings")
find_package (Lua 5 REQUIRED) find_package (Lua 5 REQUIRED)
find_package (ToLua 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 (${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) MACRO(ADD_LUA_MODULE MODULE_NAME FILES)
ADD_LIBRARY (${MODULE_NAME} SHARED ${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(eressea.pkg bind_eressea.h)
TOLUA_BINDING(settings.pkg bind_settings.h) TOLUA_BINDING(settings.pkg bind_settings.h)
set (BIND_SRC set (BINDINGS_SRC
process.pkg.c process.pkg.c
eressea.pkg.c eressea.pkg.c
settings.pkg.c settings.pkg.c
bind_process.c bind_process.c
bind_eressea.c bind_eressea.c
bind_settings.c bind_settings.c
# bind_attrib.c
bind_building.c bind_building.c
bind_faction.c bind_faction.c
bind_gmtool.c bind_gmtool.c
@ -71,5 +60,6 @@ set (BIND_SRC
helpers.c 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}) target_link_libraries(${BINDINGS_LIBRARY} ${ERESSEA_LIBRARY})

View File

@ -39,11 +39,4 @@ set (SERVER_SRC
) )
add_executable(server ${SERVER_SRC}) add_executable(server ${SERVER_SRC})
target_link_libraries(server target_link_libraries(server ${BINDINGS_LIBRARY})
${ERESSEA_LIBRARY}
${BINDINGS_LIBRARY}
${TOLUA_LIBRARIES}
${LUA_LIBRARIES}
${SQLITE3_LIBRARIES}
${CURSES_LIBRARIES}
)