Commit 2b6b5773 authored by louiz’'s avatar louiz’

cmake: do not use intermediate libraries at all (not even OBJECTS)

parent 2013ed6f
......@@ -106,9 +106,10 @@ if(LITESQL_FOUND)
"biboudb"
LITESQL_GENERATED_SOURCES)
add_library(database OBJECT src/database/database.cpp
${LITESQL_GENERATED_SOURCES})
set(source_database src/database/database.cpp ${LITESQL_GENERATED_SOURCES})
set(USE_DATABASE TRUE)
else()
set(source_database)
endif()
add_subdirectory("louloulibs")
......@@ -130,51 +131,46 @@ endif()
#
file(GLOB source_src_utils
src/utils/*.[hc]pp)
add_library(src_utils OBJECT ${source_src_utils})
#
## irclib
#
file(GLOB source_irc
src/irc/*.[hc]pp)
add_library(irc OBJECT ${source_irc})
#
## xmpp
#
file(GLOB source_xmpp
src/xmpp/*.[hc]pp)
add_library(xmpp OBJECT ${source_xmpp})
#
## identd
#
file(GLOB source_identd
src/identd/*.[hc]pp)
add_library(identd OBJECT ${source_identd})
#
## bridge
#
file(GLOB source_bridge
src/bridge/*.[hc]pp)
add_library(bridge OBJECT ${source_bridge})
#
## Main executable
#
add_executable(${PROJECT_NAME} src/main.cpp
$<TARGET_OBJECTS:utils>
$<TARGET_OBJECTS:config>
$<TARGET_OBJECTS:logger>
$<TARGET_OBJECTS:network>
$<TARGET_OBJECTS:xmpplib>
$<TARGET_OBJECTS:xmpp>
$<TARGET_OBJECTS:src_utils>
$<TARGET_OBJECTS:bridge>
$<TARGET_OBJECTS:irc>
$<TARGET_OBJECTS:identd>
$<$<BOOL:${USE_DATABASE}>:$<TARGET_OBJECTS:database>>)
${source_utils}
${source_config}
${source_logger}
${source_network}
${source_xmpplib}
${source_xmpp}
${source_src_utils}
${source_bridge}
${source_irc}
${source_identd}
${source_database})
#
## Tests
......@@ -182,17 +178,17 @@ add_executable(${PROJECT_NAME} src/main.cpp
file(GLOB source_tests
tests/*.cpp)
add_executable(test_suite EXCLUDE_FROM_ALL ${source_tests}
$<TARGET_OBJECTS:utils>
$<TARGET_OBJECTS:config>
$<TARGET_OBJECTS:logger>
$<TARGET_OBJECTS:network>
$<TARGET_OBJECTS:xmpplib>
$<TARGET_OBJECTS:xmpp>
$<TARGET_OBJECTS:src_utils>
$<TARGET_OBJECTS:bridge>
$<TARGET_OBJECTS:irc>
$<TARGET_OBJECTS:identd>
$<$<BOOL:${USE_DATABASE}>:$<TARGET_OBJECTS:database>>)
${source_utils}
${source_config}
${source_logger}
${source_network}
${source_xmpplib}
${source_xmpp}
${source_src_utils}
${source_bridge}
${source_irc}
${source_identd}
${source_database})
target_link_libraries(${PROJECT_NAME}
${EXPAT_LIBRARIES}
......
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.0)
set(${PROJECT_NAME}_VERSION_MAJOR 1)
set(${PROJECT_NAME}_VERSION_MINOR 0)
......@@ -102,35 +102,35 @@ endif()
#
file(GLOB source_utils
utils/*.[hc]pp)
add_library(utils OBJECT ${source_utils})
set(source_utils ${source_utils} PARENT_SCOPE)
#
## config
#
file(GLOB source_config
config/*.[hc]pp)
add_library(config OBJECT ${source_config})
set(source_config ${source_config} PARENT_SCOPE)
#
## logger
#
file(GLOB source_logger
logger/*.[hc]pp)
add_library(logger OBJECT ${source_logger})
set(source_logger ${source_logger} PARENT_SCOPE)
#
## network
#
file(GLOB source_network
network/*.[hc]pp)
add_library(network OBJECT ${source_network})
set(source_network ${source_network} PARENT_SCOPE)
#
## xmpplib
#
file(GLOB source_xmpplib
xmpp/*.[hc]pp)
add_library(xmpplib OBJECT ${source_xmpplib})
set(source_xmpplib ${source_xmpplib} PARENT_SCOPE)
# Define a __FILENAME__ macro with the relative path (from the base project directory)
# of each source file
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment