src/CMakeLists.txt
author Tero Marttila <terom@fixme.fi>
Tue, 31 Mar 2009 19:35:51 +0300
changeset 93 42ade8285570
parent 92 99661e5aac91
child 105 b6b183fbf373
permissions -rw-r--r--
add some rudimentary lua support, by having a simple interactive console, and providing access to irc_client_quit
# dependancies
find_package (LibEvent REQUIRED)
find_package (GnuTLS REQUIRED)
find_package (LibPQ REQUIRED)
find_package (Evsql REQUIRED)
find_package (Lua51 REQUIRED)

# add our include path
include_directories (${LibEvent_INCLUDE_DIRS} ${GnuTLS_INCLUDE_DIRS} ${Evsql_INCLUDE_DIRS} ${Lua51_INCLUDE_DIRS})

# define our source code modules
set (CORE_SOURCES error.c log.c)
set (SOCK_SOURCES sock.c sock_tcp.c sock_gnutls.c sock_test.c line_proto.c)
set (IRC_SOURCES irc_line.c irc_conn.c irc_net.c irc_chan.c chain.c irc_cmd.c irc_proto.c irc_client.c irc_user.c irc_queue.c)
set (CONSOLE_SOURCES console.c lua_console.c lua_objs.c)

set (NEXUS_SOURCES nexus.c ${CORE_SOURCES} ${SOCK_SOURCES} ${IRC_SOURCES} ${CONSOLE_SOURCES} signals.c module.c config.c)
set (TEST_SOURCES test.c ${CORE_SOURCES} ${SOCK_SOURCES} ${IRC_SOURCES})
set (IRC_LOG_SOURCES irc_log.c)

# define our libraries
set (MODULE_LIBRARIES "dl")
set (NEXUS_LIBRARIES ${LibEvent_LIBRARIES} ${GnuTLS_LIBRARIES} ${MODULE_LIBRARIES} "readline" ${Lua51_LIBRARIES})

# compiler flags
set (CFLAGS "-Wall -Wextra -std=gnu99")

# add our binaries
add_executable (nexus ${NEXUS_SOURCES})
add_executable (test EXCLUDE_FROM_ALL ${TEST_SOURCES})

# add our modules
add_library (irc_log MODULE ${IRC_LOG_SOURCES})

# set libraries
target_link_libraries (nexus ${NEXUS_LIBRARIES})
target_link_libraries (test ${NEXUS_LIBRARIES})
target_link_libraries (irc_log ${Evsql_LIBRARIES})

# global target properties
set_target_properties (nexus test irc_log PROPERTIES
    COMPILE_FLAGS   ${CFLAGS}
)

# nexus needs to export its symbols to be able to load modules
set_target_properties (nexus PROPERTIES
    LINK_FLAGS      "--export-dynamic"
)

# modules have weird names
set_target_properties (irc_log PROPERTIES
    PREFIX                      "mod_"
    LIBRARY_OUTPUT_DIRECTORY    "modules"
)

## setup install info
#install (TARGETS evirc
#    LIBRARY         DESTINATION lib
#    ARCHIVE         DESTINATION lib/static
#    PUBLIC_HEADER   DESTINATION include
#)