diff options
author | Simon McVittie <smcv@collabora.com> | 2018-09-03 15:27:29 -0700 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2019-01-21 15:14:29 +0000 |
commit | d7644b7d4ffd0171891d00e819ef000494dfd63e (patch) | |
tree | 427241c2ded197d155c1600fe9a961af3593ad6f /cmake | |
parent | 651a82e685638ad75d881112e013b9623a368416 (diff) | |
download | dbus-d7644b7d4ffd0171891d00e819ef000494dfd63e.tar.gz |
build: Compile most bus/ files into static libraries
This means we can share them between tests without having to compile
the same file repeatedly, and makes them easier to share between
directories when we move test executables into test/.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/bus/CMakeLists.txt | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/cmake/bus/CMakeLists.txt b/cmake/bus/CMakeLists.txt index 8c0c8e66..24f3bf69 100644 --- a/cmake/bus/CMakeLists.txt +++ b/cmake/bus/CMakeLists.txt @@ -98,8 +98,11 @@ if(WIN32) list(APPEND BUS_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/versioninfo-${DBUS_VER_INTERNAL_NAME}.rc) endif() -add_executable(dbus-daemon ${BUS_SOURCES} ${BUS_DIR}/main.c) -target_link_libraries(dbus-daemon ${DBUS_INTERNAL_LIBRARIES} ${EXPAT_LIBRARIES}) +add_library(dbus-daemon-internal STATIC ${BUS_SOURCES}) +target_link_libraries(dbus-daemon-internal ${DBUS_INTERNAL_LIBRARIES} ${EXPAT_LIBRARIES}) + +add_executable(dbus-daemon ${BUS_DIR}/main.c) +target_link_libraries(dbus-daemon dbus-daemon-internal) set_target_properties(dbus-daemon PROPERTIES OUTPUT_NAME ${DBUS_DAEMON_NAME}) set_target_properties(dbus-daemon PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS}) @@ -142,35 +145,29 @@ set(LAUNCH_HELPER_SOURCES ${BUS_DIR}/config-parser-trivial.c ${BUS_DIR}/desktop-file.c ${BUS_DIR}/utils.c - ${BUS_DIR}/activation-helper.c ) if(NOT WIN32) - add_executable(dbus-daemon-launch-helper ${LAUNCH_HELPER_SOURCES} ${BUS_DIR}/activation-helper-bin.c ) - target_link_libraries(dbus-daemon-launch-helper ${DBUS_INTERNAL_LIBRARIES} ${EXPAT_LIBRARIES} ) - install(TARGETS dbus-daemon-launch-helper ${INSTALL_TARGETS_DEFAULT_ARGS} RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}) + add_library(launch-helper-internal STATIC ${LAUNCH_HELPER_SOURCES}) + target_link_libraries(launch-helper-internal ${DBUS_INTERNAL_LIBRARIES} ${EXPAT_LIBRARIES}) + + add_executable(dbus-daemon-launch-helper ${BUS_DIR}/activation-helper.c ${BUS_DIR}/activation-helper-bin.c ) + target_link_libraries(dbus-daemon-launch-helper launch-helper-internal) endif(NOT WIN32) if (DBUS_ENABLE_EMBEDDED_TESTS) - set(SOURCES ${BUS_SOURCES} ${BUS_DIR}/test-main.c) - add_test_executable(test-bus "${SOURCES}" ${DBUS_INTERNAL_LIBRARIES} ${EXPAT_LIBRARIES}) + set(SOURCES ${BUS_DIR}/test-main.c) + add_test_executable(test-bus "${SOURCES}" dbus-daemon-internal ${DBUS_INTERNAL_LIBRARIES} ${EXPAT_LIBRARIES}) set_target_properties(test-bus PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS}) if (NOT WIN32) - set(test_bus_system_SOURCES - ${BUS_DIR}/config-loader-expat.c - ${BUS_DIR}/config-parser-common.c - ${BUS_DIR}/config-parser-trivial.c - ${BUS_DIR}/utils.c - ${BUS_DIR}/test-system.c - ) - add_test_executable(test-bus-system "${test_bus_system_SOURCES}" ${DBUS_INTERNAL_LIBRARIES} ${EXPAT_LIBRARIES} ${DBUS_BUS_LIBS}) - - add_executable(dbus-daemon-launch-helper-test ${LAUNCH_HELPER_SOURCES} ${BUS_DIR}/activation-helper-bin.c) + add_test_executable(test-bus-system ${BUS_DIR}/test-system.c launch-helper-internal) + + add_executable(dbus-daemon-launch-helper-test ${BUS_DIR}/activation-helper.c ${BUS_DIR}/activation-helper-bin.c) set_target_properties(dbus-daemon-launch-helper-test PROPERTIES COMPILE_FLAGS "-DACTIVATION_LAUNCHER_TEST") - target_link_libraries(dbus-daemon-launch-helper-test ${DBUS_INTERNAL_LIBRARIES} ${EXPAT_LIBRARIES} ) + target_link_libraries(dbus-daemon-launch-helper-test launch-helper-internal) - set (SOURCES ${LAUNCH_HELPER_SOURCES} ${BUS_DIR}/test-launch-helper.c) - add_test_executable(test-bus-launch-helper "${SOURCES}" ${DBUS_INTERNAL_LIBRARIES} ${EXPAT_LIBRARIES}) + set (SOURCES ${BUS_DIR}/activation-helper.c ${BUS_DIR}/test-launch-helper.c) + add_test_executable(test-bus-launch-helper "${SOURCES}" launch-helper-internal) set_target_properties(test-bus-launch-helper PROPERTIES COMPILE_FLAGS "-DACTIVATION_LAUNCHER_TEST -DACTIVATION_LAUNCHER_DO_OOM") endif() endif (DBUS_ENABLE_EMBEDDED_TESTS) |