summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/CMakeLists.txt8
-rw-r--r--cmake/bus/CMakeLists.txt3
-rw-r--r--cmake/dbus/CMakeLists.txt18
-rw-r--r--cmake/test/CMakeLists.txt2
-rw-r--r--dbus/dbus-macros.h4
5 files changed, 29 insertions, 6 deletions
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 80db3de8..0d4da13c 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -495,7 +495,13 @@ if (DBUS_BUILD_TESTS)
endif (DBUS_BUILD_TESTS)
set(DBUS_LIBRARIES dbus-1)
-set(DBUS_INTERNAL_LIBRARIES dbus-1 dbus-internal)
+set(DBUS_INTERNAL_LIBRARIES dbus-internal)
+
+# settings for building and using static internal lib
+# important note: DBUS_INTERNAL_xxxxx_DEFINITIONS must *not* be set when building dbus-1 library
+set (DBUS_INTERNAL_ADD_LIBRARY_OPTIONS STATIC)
+set (DBUS_INTERNAL_LIBRARY_DEFINITIONS "-DDBUS_STATIC_BUILD")
+set (DBUS_INTERNAL_CLIENT_DEFINITIONS "-DDBUS_STATIC_BUILD")
########### subdirs ###############
diff --git a/cmake/bus/CMakeLists.txt b/cmake/bus/CMakeLists.txt
index 23dd05b6..1cfd1479 100644
--- a/cmake/bus/CMakeLists.txt
+++ b/cmake/bus/CMakeLists.txt
@@ -80,6 +80,7 @@ include_directories(${XML_INCLUDE_DIR})
add_executable(dbus-daemon ${BUS_SOURCES} ${BUS_DIR}/main.c)
target_link_libraries(dbus-daemon ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY})
set_target_properties(dbus-daemon PROPERTIES OUTPUT_NAME ${DBUS_DAEMON_NAME})
+set_target_properties(dbus-daemon PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
install_targets(/bin dbus-daemon)
install_files(/etc FILES ${config_DATA})
@@ -94,12 +95,14 @@ if (DBUS_SERVICE)
add_executable(dbus-service ${dbus_service_SOURCES} )
target_link_libraries(dbus-service ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY})
+ set_target_properties(dbus-service PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
install_targets(/bin dbus-service )
endif (DBUS_SERVICE)
if (DBUS_BUILD_TESTS)
add_executable(bus-test ${BUS_SOURCES} ${BUS_DIR}/test-main.c)
target_link_libraries(bus-test ${DBUS_INTERNAL_LIBRARIES} ${XML_LIBRARY})
+ set_target_properties(bus-test PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
add_test(bus-test ${EXECUTABLE_OUTPUT_PATH}/bus-test ${CMAKE_BINARY_DIR}/test/data)
endif (DBUS_BUILD_TESTS)
diff --git a/cmake/dbus/CMakeLists.txt b/cmake/dbus/CMakeLists.txt
index db46113f..57c499f5 100644
--- a/cmake/dbus/CMakeLists.txt
+++ b/cmake/dbus/CMakeLists.txt
@@ -264,16 +264,26 @@ install_files(/include/dbus FILES ${dbusinclude_HEADERS})
### Internal library, used for the daemon, tools and tests, compiled statically.
-add_library(dbus-internal STATIC
+add_library(dbus-internal ${DBUS_INTERNAL_ADD_LIBRARY_OPTIONS}
+ ${DBUS_LIB_SOURCES}
+ ${DBUS_LIB_HEADERS}
+ ${DBUS_SHARED_SOURCES}
+ ${DBUS_SHARED_HEADERS}
${DBUS_UTIL_SOURCES}
- ${DBUS_UTIL_HEADERS})
-target_link_libraries(dbus-internal dbus-1)
+ ${DBUS_UTIL_HEADERS}
+)
+target_link_libraries(dbus-internal)
+set_target_properties(dbus-internal PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_LIBRARY_DEFINITIONS})
+if(WIN32)
+ target_link_libraries(dbus-internal ws2_32 advapi32 netapi32)
+endif(WIN32)
if (DBUS_BUILD_TESTS)
set (TESTS_ENVIRONMENT "DBUS_TEST_DATA=${CMAKE_SOURCE_DIR}/test/data DBUS_TEST_HOMEDIR=${CMAKE_BUILD_DIR}/dbus")
ADD_EXECUTABLE(dbus-test ${CMAKE_SOURCE_DIR}/../dbus/dbus-test-main.c)
- target_link_libraries(dbus-test dbus-1 dbus-internal)
+ target_link_libraries(dbus-test ${DBUS_INTERNAL_LIBRARIES})
add_test(dbus-test ${EXECUTABLE_OUTPUT_PATH}/dbus-test ${CMAKE_SOURCE_DIR}/../test/data)
+ set_target_properties(dbus-test PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS})
ENDIF (DBUS_BUILD_TESTS)
if (UNIX)
diff --git a/cmake/test/CMakeLists.txt b/cmake/test/CMakeLists.txt
index 93d677dc..393c494a 100644
--- a/cmake/test/CMakeLists.txt
+++ b/cmake/test/CMakeLists.txt
@@ -1,5 +1,7 @@
project(test)
+add_definitions(${DBUS_INTERNAL_CLIENT_DEFINITIONS})
+
add_subdirectory( name-test )
set (test-service_SOURCES
diff --git a/dbus/dbus-macros.h b/dbus/dbus-macros.h
index 3102a95e..d1e40ecb 100644
--- a/dbus/dbus-macros.h
+++ b/dbus/dbus-macros.h
@@ -158,7 +158,9 @@
*/
#if defined(_WIN32)
-# if defined(dbus_1_EXPORTS)
+# if defined(DBUS_STATIC_BUILD)
+# define DBUS_EXPORT
+# elif defined(dbus_1_EXPORTS)
# define DBUS_EXPORT __declspec(dllexport)
# else
# define DBUS_EXPORT __declspec(dllimport)