src/CMakeLists.txt
branchbuild-cmake
changeset 59 375a3b5c3a46
child 67 aa94bf2b5f9b
equal deleted inserted replaced
58:65bd90f94f4e 59:375a3b5c3a46
       
     1 # dependancies
       
     2 find_package (LibEvent REQUIRED)
       
     3 find_package (GnuTLS REQUIRED)
       
     4 
       
     5 # add our include path
       
     6 include_directories (${LibEvent_INCLUDE_DIRS} ${GnuTLS_INCLUDE_DIRS})
       
     7 
       
     8 # define our source code modules
       
     9 set (CORE_SOURCES error.c log.c)
       
    10 set (SOCK_SOURCES sock.c sock_tcp.c sock_gnutls.c sock_test.c line_proto.c)
       
    11 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)
       
    12 
       
    13 set (NEXUS_SOURCES nexus.c ${CORE_SOURCES} ${SOCK_SOURCES} ${IRC_SOURCES} signals.c module.c)
       
    14 set (TEST_SOURCES test.c ${CORE_SOURCES} ${SOCK_SOURCES} ${IRC_SOURCES})
       
    15 set (IRC_LOG_SOURCES irc_log.c)
       
    16 
       
    17 # define our libraries
       
    18 set (MODULE_LIBRARIES "dl")
       
    19 set (NEXUS_LIBRARIES ${LibEvent_LIBRARIES} ${GnuTLS_LIBRARIES} ${MODULE_LIBRARIES})
       
    20 
       
    21 # compiler flags
       
    22 set (CFLAGS "-Wall -Wextra")
       
    23 
       
    24 # add our binaries
       
    25 add_executable (nexus ${NEXUS_SOURCES})
       
    26 add_executable (test EXCLUDE_FROM_ALL ${TEST_SOURCES})
       
    27 
       
    28 # add our modules
       
    29 add_library (irc_log MODULE ${IRC_LOG_SOURCES})
       
    30 
       
    31 # set libraries
       
    32 target_link_libraries (nexus ${NEXUS_LIBRARIES})
       
    33 target_link_libraries (test ${NEXUS_LIBRARIES})
       
    34 
       
    35 # global target properties
       
    36 set_target_properties (nexus test irc_log PROPERTIES
       
    37     COMPILE_FLAGS   ${CFLAGS}
       
    38 )
       
    39 
       
    40 # nexus needs to export its symbols to be able to load modules
       
    41 set_target_properties (nexus PROPERTIES
       
    42     LINK_FLAGS      "--export-dynamic"
       
    43 )
       
    44 
       
    45 # modules have weird names
       
    46 set_target_properties (irc_log PROPERTIES
       
    47     LIBRARY_OUTPUT_DIRECTORY    "modules"
       
    48 )
       
    49 
       
    50 ## setup install info
       
    51 #install (TARGETS evirc
       
    52 #    LIBRARY         DESTINATION lib
       
    53 #    ARCHIVE         DESTINATION lib/static
       
    54 #    PUBLIC_HEADER   DESTINATION include
       
    55 #)
       
    56