Commit 46684804 authored by Christian Ehrlicher's avatar Christian Ehrlicher Committed by unknown
Browse files

merge changes done to the cmake-buildsystem from the sf.net windbus-svn trunk....

merge changes done to the cmake-buildsystem from the sf.net windbus-svn trunk. tested and works fine with at least msvc2008. (cherry picked from commit 45c168fd61e3f6447e014df4bb6417efbe725ccd)
parent a83b7cb8
......@@ -2,19 +2,28 @@ set (PACKAGE dbus)
# the version major, minor and release number should be synchron to the dbus cvs - windows releases should only update the patch level
set (VERSION_MAJOR "1")
set (VERSION_MINOR "1")
set (VERSION_RELEASE "1")
set (VERSION_PATCH "2")
set (VERSION_MINOR "2")
set (VERSION_RELEASE "14")
set (VERSION_PATCH "0")
if (VERSION_PATCH)
set (VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}-${VERSION_PATCH}" )
else (VERSION_PATCH)
set (VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}" )
endif (VERSION_PATCH)
set (DBUS_MAJOR_VERSION ${VERSION_MAJOR})
set (DBUS_MINOR_VERSION ${VERSION_MAJOR})
set (DBUS_MICRO_VERSION ${VERSION_MAJOR})
set (DBUS_MAJOR_VERSION ${VERSION_MAJOR})
set (DBUS_VERSION ${VERSION})
set (DBUS_VERSION_STRING "${VERSION}")
project(${PACKAGE})
# we need to be up to date
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.4 FATAL_ERROR)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
......@@ -25,7 +34,7 @@ SET(BUILD_SHARED_LIBS ON)
if (CYGWIN)
set (WIN32)
endif (CYGWIN)
# search for required packages
if (WIN32)
# include local header first to avoid using old installed header
......@@ -43,7 +52,7 @@ find_package(X11)
# do config checks
INCLUDE(ConfigureChecks.cmake)
# @TODO: how to remove last dir from ${CMAKE_SOURCE_DIR} ?
# @TODO: how to remove last dir from ${CMAKE_SOURCE_DIR} ?
SET(DBUS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/..)
# make some more macros available
......@@ -62,19 +71,19 @@ if(MSVC)
set(GROUP_CODE flat)
endif(NOT GROUP_CODE)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
# Use the highest warning level
if (WALL)
set(WALL 1 CACHE TYPE STRING FORCE)
set(CMAKE_CXX_WARNING_LEVEL 4 CACHE TYPE STRING FORCE)
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
STRING(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
if(CMAKE_C_FLAGS MATCHES "/W[0-4]")
STRING(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
else(CMAKE_C_FLAGS MATCHES "/W[0-4]")
......@@ -83,19 +92,20 @@ if(MSVC)
else (WALL)
set(CMAKE_CXX_WARNING_LEVEL 3 CACHE TYPE STRING FORCE)
endif (WALL)
SET(MSVC_W_ERROR " /we4028 /we4013 /we4133 /we4047 /we4031 /we4002 /we4003 /we4114")
SET(MSVC_W_DISABLE " /wd4127 /wd4090 /wd4101 /wd4244")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /FIconfig.h ${MSVC_W_ERROR} ${MSVC_W_DISABLE}")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /FIconfig.h ${MSVC_W_ERROR} ${MSVC_W_DISABLE}")
endif(MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# used by executables, CMAKE_DEBUG_POSTFIX does not handle this case
#set (CMAKE_EXE_POSTFIX "d")
#set (CMAKE_DEBUG_POSTFIX "d")
endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
endif(MSVC)
if(WIN32)
set (CMAKE_DEBUG_POSTFIX "d")
endif(WIN32)
#########################################################################
# Windows CE
......@@ -110,9 +120,9 @@ if(wince)
# don't forget parameters
set(wince 1 CACHE TYPE STRING FORCE)
set(wcelibcex ${wcelibcex} CACHE TYPE STRING FORCE)
include_directories(${wcelibcex}/include/wcelibcex ${wcelibcex}/src)
add_definitions(
# see config.h.cmake
# -DDBUS_WINCE
......@@ -123,22 +133,22 @@ if(wince)
-DUNICODE
-DPOCKETPC2003_UI_MODEL
)
# Windows CE Version
add_definitions(
-D_WIN32_WCE=0x420
-DWIN32_PLATFORM_PSPC=0x420
-DUNDER_CE=0x420
)
# Architecture
add_definitions(
-DARM
-D_ARM_
)
set(CMAKE_CXX_STANDARD_LIBRARIES "coredll.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib ws2.lib")
set(CMAKE_SHARED_LINKER_FLAGS "/subsystem:windowsce,4.20 /machine:THUMB")
endif(wince)
......@@ -167,8 +177,7 @@ endif (WIN32 OR CYGWIN)
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
# for including config.h and for includes like <dir/foo.h>
include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} )
include_directories( ${CMAKE_INCLUDE_PATH} )
include_directories( ${CMAKE_SOURCE_DIR}/.. ${CMAKE_BINARY_DIR} ${CMAKE_INCLUDE_PATH} )
# linker search directories
link_directories(${DBUS_LIB_DIR} ${LIBRARY_OUTPUT_PATH} )
......@@ -190,7 +199,7 @@ endif (DBUSDIR)
if (NOT DBUS_INSTALL_DIR)
set(DBUS_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" CACHE TYPE STRING)
endif (NOT DBUS_INSTALL_DIR)
# TODO: setting EXPANDED_... has nothing to do with DBUS_INSTALL_SYSTEM_LIBS
if (DBUS_INSTALL_SYSTEM_LIBS)
set(prefix ${DBUS_INSTALL_DIR})
......@@ -208,7 +217,7 @@ else (DBUS_INSTALL_SYSTEM_LIBS)
if (MSVC_IDE)
set(EXPANDED_BINDIR ${CMAKE_BINARY_DIR}/bin/debug)
else (MSVC_IDE)
set(EXPANDED_BINDIR ${CMAKE_BINARY_DIR}/bin)
set(EXPANDED_BINDIR ${CMAKE_BINARY_DIR}/bin)
endif (MSVC_IDE)
set(DBUS_BINDIR ${EXPANDED_BINDIR})
set(DBUS_MACHINE_UUID_FILE ${CMAKE_BINARY_DIR}/lib/dbus/machine-id)
......@@ -217,15 +226,15 @@ endif (DBUS_INSTALL_SYSTEM_LIBS)
set (DBUS_DAEMONDIR ${EXPANDED_BINDIR})
########### command line options ###############
# TODO: take check from configure.in
# TODO: take check from configure.in
#AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests],[enable unit test code]),enable_tests=$enableval,enable_tests=$USE_MAINTAINER_MODE)
OPTION(DBUS_BUILD_TESTS "enable unit test code" ON)
if (DBUS_BUILD_TESTS)
if (DBUS_BUILD_TESTS)
if(NOT MSVC AND NOT CMAKE_BUILD_TYPE MATCHES Release)
add_definitions(-g)
endif(NOT MSVC AND NOT CMAKE_BUILD_TYPE MATCHES Release)
endif (DBUS_BUILD_TESTS)
endif (DBUS_BUILD_TESTS)
# win32 dbus service support - this support is not complete
OPTION(DBUS_SERVICE "enable dbus service installer" OFF)
......@@ -237,7 +246,7 @@ if(DBUS_ENABLE_ANSI)
add_definitions(-ansi -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -pedantic)
else(NOT MSVC)
add_definitions(-Za -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -W4)
endif(NOT MSVC)
endif(NOT MSVC)
endif(DBUS_ENABLE_ANSI)
#AC_ARG_ENABLE(verbose-mode, AS_HELP_STRING([--enable-verbose-mode],[support verbose debug mode]),enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
......@@ -257,7 +266,7 @@ if(DBUS_GCOV_ENABLED)
# FIXME!!!!
## remove optimization
# CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
endif(NOT MSVC)
endif(NOT MSVC)
endif(DBUS_GCOV_ENABLED)
#AC_ARG_ENABLE(abstract-sockets, AS_HELP_STRING([--enable-abstract-sockets],[use abstract socket namespace (linux only)]),enable_abstract_sockets=$enableval,enable_abstract_sockets=auto)
......@@ -351,12 +360,34 @@ if (WIN32)
set (EXT ".exe")
endif(WIN32)
set(TEST_SERVICE_DIR ${CMAKE_BINARY_DIR}/test/data/valid-service-files CACHE STRING "Full path to test file test/data/valid-service-files in builddir")
set(TEST_SERVICE_BINARY ${CMAKE_BINARY_DIR}/bin/test-service${EXT} CACHE STRING "Full path to test file test/test-service in builddir")
set(TEST_SHELL_SERVICE_BINARY ${CMAKE_BINARY_DIR}/bin/test-shell-service${EXT} CACHE STRING "Full path to test file test/test-shell-service in builddir")
set(TEST_EXIT_BINARY ${CMAKE_BINARY_DIR}/bin/test-exit${EXT} CACHE STRING "Full path to test file test/test-exit in builddir")
set(TEST_SEGFAULT_BINARY ${CMAKE_BINARY_DIR}/bin/test-segfault${EXT} CACHE STRING "Full path to test file test/test-segfault in builddir")
set(TEST_SLEEP_FOREVER_BINARY ${CMAKE_BINARY_DIR}/bin/test-sleep-forever${EXT} CACHE STRING "Full path to test file test/test-sleep-forever in builddir")
if (MSVC_IDE)
if (test_debug)
set(test_debug TRUE CACHE TYPE STRING FORCE)
set(IDE_BIN Debug/ )
message(STATUS)
message(STATUS "Using Visual Studio: test programs will only work with the 'Debug' configuration!")
message(STATUS "To run the tests with the 'Release' configuration use -Dtest_debug=0")
message(STATUS "Add '..\\..\\test\\data' to the command line option of the test programs")
message(STATUS)
else (test_debug)
set(test_debug FALSE CACHE TYPE STRING FORCE)
set(IDE_BIN Release/)
message(STATUS)
message(STATUS "Using Visual Studio: test programs will only work with the 'Release' configuration!")
message(STATUS "To run the tests with the 'Debug' configuration use -Dtest_debug=1")
message(STATUS "Add '..\\..\\test\\data' to the command line option of the test programs")
message(STATUS)
endif (test_debug)
set (TEST_PATH_FORCE FORCE)
FILE(REMOVE ${CMAKE_BINARY_DIR}/data/dbus-1/services)
endif (MSVC_IDE)
set(TEST_SERVICE_DIR ${CMAKE_BINARY_DIR}/test/data/valid-service-files CACHE STRING "Full path to test file test/data/valid-service-files in builddir" )
set(TEST_SERVICE_BINARY ${CMAKE_BINARY_DIR}/bin/${IDE_BIN}test-service${EXT} CACHE STRING "Full path to test file test/test-service in builddir" ${TEST_PATH_FORCE})
set(TEST_SHELL_SERVICE_BINARY ${CMAKE_BINARY_DIR}/bin/${IDE_BIN}test-shell-service${EXT} CACHE STRING "Full path to test file test/test-shell-service in builddir" ${TEST_PATH_FORCE})
set(TEST_EXIT_BINARY ${CMAKE_BINARY_DIR}/bin/${IDE_BIN}test-exit${EXT} CACHE STRING "Full path to test file test/test-exit in builddir" ${TEST_PATH_FORCE})
set(TEST_SEGFAULT_BINARY ${CMAKE_BINARY_DIR}/bin/${IDE_BIN}test-segfault${EXT} CACHE STRING "Full path to test file test/test-segfault in builddir" ${TEST_PATH_FORCE})
set(TEST_SLEEP_FOREVER_BINARY ${CMAKE_BINARY_DIR}/bin/${IDE_BIN}test-sleep-forever${EXT} CACHE STRING "Full path to test file test/test-sleep-forever in builddir" ${TEST_PATH_FORCE})
#### Find socket directories
if (NOT WIN32)
......@@ -386,7 +417,7 @@ endif (NOT WIN32)
#else
# DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/dbus/pid
#fi
# TODO: fix redhet
# TODO: fix redhet
if (WIN32)
# bus-test expects a non empty string
set (DBUS_SYSTEM_PID_FILE "/dbus-pid")
......@@ -410,12 +441,12 @@ set (DBUS_USER )
if (WIN32)
set (DBUS_SESSION_BUS_DEFAULT_ADDRESS "tcp:host=localhost,port=12434")
set (DBUS_SYSTEM_BUS_DEFAULT_ADDRESS "tcp:host=localhost,port=12434")
set (DBUS_SESSION_BUS_DEFAULT_ADDRESS "tcp:host=localhost,port=0")
set (DBUS_SYSTEM_BUS_DEFAULT_ADDRESS "tcp:host=localhost,port=0")
set (DBUS_SYSTEM_CONFIG_FILE "etc/system.conf")
set (DBUS_SESSION_CONFIG_FILE "etc/session.conf")
# bus-test expects a non empty string
set (DBUS_USER "Administrator")
set (DBUS_USER "Administrator")
set (DBUS_DATADIR "data")
else (WIN32)
set (DBUS_SYSTEM_BUS_DEFAULT_ADDRESS unix:tmpdir=)
......@@ -424,30 +455,48 @@ else (WIN32)
set (configdir ${sysconfdir}/dbus-1 )
set (DBUS_SYSTEM_CONFIG_FILE ${configdir}/system.conf)
set (DBUS_SESSION_CONFIG_FILE ${configdir}/session.conf)
set (DBUS_USER "root")
set (DBUS_USER "root")
set (DBUS_DATADIR ${EXPANDED_DATADIR})
endif (WIN32)
set (DAEMON_NAME dbus-daemon)
set (DAEMON_NAME dbus-daemon)
########### create config.h ###############
#include(ConfigureChecks.cmake)
# better use flags for gcc
# better use flags for gcc
if (MINGW)
set (HAVE_GNUC_VARARGS 1)
endif(MINGW)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dbus-env.bat.cmake ${CMAKE_BINARY_DIR}/bin/dbus-env.bat )
install_files(/bin FILES ${CMAKE_BINARY_DIR}/bin/dbus-env.bat)
install_files(/bin FILES ${CMAKE_BINARY_DIR}/bin/dbus-env.bat)
# compiler definitions
# compiler definitions
add_definitions(-DHAVE_CONFIG_H=1)
add_definitions(${DBUS_BUS_CFLAGS} -DDBUS_API_SUBJECT_TO_CHANGE)
option(splitlib "split library into dbus-lib-client, dbus-lib-generic, and dbus-lib-util, no installing possible" OFF)
if(splitlib AND MSVC)
# does not work with GCC/ld
set(DBUS_1 dbus-lib-client dbus-lib-generic dbus-lib-util)
message(STATUS "")
message(STATUS "dbus library is splitted into dbus-lib-client, dbus-lib-generic, and dbus-lib-util")
message(STATUS "installing is not possible")
message(STATUS "disable splitting: -Dsplitlib=0")
message(STATUS "")
else(splitlib AND MSVC)
message(STATUS "")
message(STATUS "for better code reading the dbus library could be splitted into three libraries:")
message(STATUS "dbus-lib-client, dbus-lib-generic, and dbus-lib-util (installing is then not possible)")
message(STATUS "enable splitting: -Dsplitlib=1")
message(STATUS "")
set(DBUS_1 dbus-1)
endif(splitlib AND MSVC)
########### subdirs ###############
add_subdirectory( dbus )
......
include_directories(${CMAKE_SOURCE_DIR}/..)
include_directories( ${CMAKE_INCLUDE_PATH} )
project(bus)
add_definitions(-DDBUS_COMPILATION)
......@@ -45,8 +43,11 @@ set (BUS_SOURCES
${BUS_DIR}/bus.c
${BUS_DIR}/bus.h
${BUS_DIR}/config-parser.c
${BUS_DIR}/config-parser.h
${BUS_DIR}/connection.c
${BUS_DIR}/config-parser.h
${BUS_DIR}/config-parser-common.c
${BUS_DIR}/config-parser-common.h
# ${BUS_DIR}/config-parser-trivial.c
${BUS_DIR}/connection.c
${BUS_DIR}/connection.h
${BUS_DIR}/desktop-file.c
${BUS_DIR}/desktop-file.h
......@@ -74,30 +75,34 @@ set (BUS_SOURCES
${DIR_WATCH_SOURCE}
)
set (dbus_daemon_SOURCES
${BUS_SOURCES}
${BUS_DIR}/main.c
)
include_directories(${XML_INCLUDE_DIR})
SET (LIBS ${XML_LIBRARY})
add_executable(dbus-daemon${CMAKE_EXE_POSTFIX} ${dbus_daemon_SOURCES})
target_link_libraries(dbus-daemon${CMAKE_EXE_POSTFIX} dbus-1 ${LIBS})
install_targets(/bin dbus-daemon${CMAKE_EXE_POSTFIX} )
if(splitlib AND MSVC)
add_library(bus-lib STATIC ${BUS_SOURCES})
add_executable(dbus-daemon ${BUS_DIR}/main.c)
target_link_libraries(dbus-daemon ${DBUS_1} ${LIBS} bus-lib)
else(splitlib AND MSVC)
add_executable(dbus-daemon ${BUS_SOURCES} ${BUS_DIR}/main.c)
target_link_libraries(dbus-daemon ${DBUS_1} ${LIBS})
endif(splitlib AND MSVC)
set_target_properties(dbus-daemon PROPERTIES DEBUG_POSTFIX d)
install_targets(/bin dbus-daemon)
install_files(/etc FILES ${config_DATA})
if (DBUS_SERVICE)
set (dbus_service_SOURCES
${BUS_DIR}/bus-service-win.c
# TODO: add additional files
# TODO: add additional files
# ${BUS_DIR}/service-main.c
# ${BUS_SOURCES}
)
add_executable(dbus-service${CMAKE_EXE_POSTFIX} ${dbus_service_SOURCES} )
target_link_libraries(dbus-service${CMAKE_EXE_POSTFIX} dbus-1 ${LIBS})
install_targets(/bin dbus-service${CMAKE_EXE_POSTFIX} )
add_executable(dbus-service ${dbus_service_SOURCES} )
target_link_libraries(dbus-service ${DBUS_1} ${LIBS})
install_targets(/bin dbus-service )
set_target_properties(dbus-service PROPERTIES DEBUG_POSTFIX d)
endif (DBUS_SERVICE)
......@@ -115,14 +120,14 @@ endif (DBUS_SERVICE)
## even when not doing "make check"
#noinst_PROGRAMS=$(TESTS)
set (bus_test_SOURCES
${BUS_SOURCES}
${BUS_DIR}/test-main.c
)
if (DBUS_BUILD_TESTS)
add_executable(bus-test ${bus_test_SOURCES})
target_link_libraries(bus-test dbus-1 ${LIBS} )
if(splitlib AND MSVC)
add_executable(bus-test ${BUS_DIR}/test-main.c)
target_link_libraries(bus-test ${DBUS_1} ${LIBS} bus-lib)
else(splitlib AND MSVC)
add_executable(bus-test ${BUS_SOURCES} ${BUS_DIR}/test-main.c)
target_link_libraries(bus-test ${DBUS_1} ${LIBS})
endif(splitlib AND MSVC)
#install_targets(/bin bus-test)
add_test(bus-test ${EXECUTABLE_OUTPUT_PATH}/bus-test ${CMAKE_SOURCE_DIR}/../test/data)
endif (DBUS_BUILD_TESTS)
......
......@@ -19,6 +19,12 @@
#cmakedefine PACKAGE "@PACKAGE@"
/* Version number of package */
#cmakedefine VERSION "@VERSION@"
#cmakedefine DBUS_MAJOR_VERSION ${VERSION_MAJOR}
#cmakedefine DBUS_MINOR_VERSION ${VERSION_MINOR}
#cmakedefine DBUS_MICRO_VERSION ${VERSION_RELEASE}
#cmakedefine DBUS_VERSION ((@VERSION_MAJOR@ << 16) | (@VERSION_MINOR@ << 8) | (@VERSION_RELEASE@))
#cmakedefine DBUS_VERSION_STRING "@VERSION@"
// test binaries
/* Full path to test file test/test-exit in builddir */
#define TEST_BUS_BINARY "@TEST_BUS_BINARY@"
......
project(dbus)
project(dbus-lib)
#INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) -DDBUS_COMPILATION
include_directories(${CMAKE_SOURCE_DIR}/..)
SET(DBUS_DIR ${CMAKE_SOURCE_DIR}/../dbus)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dbus-arch-deps.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/dbus-arch-deps.h )
......@@ -24,6 +23,7 @@ set (dbusinclude_HEADERS
${DBUS_DIR}/dbus-server.h
${DBUS_DIR}/dbus-shared.h
${DBUS_DIR}/dbus-signature.h
${DBUS_DIR}/dbus-spawn.h
${DBUS_DIR}/dbus-threads.h
${DBUS_DIR}/dbus-types.h
dbus-arch-deps.h
......@@ -64,6 +64,8 @@ set (DBUS_LIB_SOURCES
# find a clean Windows implementation
# and move code to a *-win.c file
)
if(UNIX)
set (DBUS_LIB_SOURCES ${DBUS_LIB_SOURCES}
${DBUS_DIR}/dbus-transport-unix.c
......@@ -225,17 +227,57 @@ set(libdbus_HEADERS
${DBUS_UTIL_HEADERS}
)
if(MSVC)
add_library(dbus-1 STATIC ${libdbus_SOURCES} ${libdbus_HEADERS} )
project_source_group(${GROUP_CODE} libdbus_SOURCES libdbus_HEADERS)
else(MSVC)
add_library(dbus-1 ${libdbus_SOURCES} ${libdbus_HEADERS} )
endif(MSVC)
if(MSVC AND splitlib)
set(DBUS_LIB_TYPE STATIC)
elseif(MSVC AND splitlib)
set(DBUS_LIB_TYPE SHARED)
endif(MSVC AND splitlib)
if(splitlib AND MSVC)
# code for the client library and daemon/tests
add_library(dbus-lib-generic ${DBUS_LIB_TYPE} ${DBUS_SHARED_SOURCES} ${DBUS_SHARED_HEADERS})
# code only for daemon/tests
add_library(dbus-lib-util ${DBUS_LIB_TYPE} ${DBUS_UTIL_SOURCES} ${DBUS_UTIL_HEADERS})
# code for the client library
add_library(dbus-lib-client ${DBUS_LIB_TYPE} ${DBUS_LIB_SOURCES} ${DBUS_LIB_HEADERS})
target_link_libraries(dbus-lib-generic ${LIBS})
target_link_libraries(dbus-lib-util ${LIBS})
target_link_libraries(dbus-lib-client ${LIBS})
if(MSVC_IDE)
project_source_group(${GROUP_CODE} DBUS_LIB_SOURCES DBUS_LIB_HEADERS)
project_source_group(${GROUP_CODE} DBUS_SHARED_SOURCES DBUS_SHARED_HEADERS)
project_source_group(${GROUP_CODE} DBUS_UTIL_SOURCES DBUS_UTIL_SOURCES)
endif(MSVC_IDE)
else(splitlib AND MSVC)
# all code into one library
add_library(dbus-1 ${DBUS_LIB_TYPE} ${libdbus_SOURCES} ${libdbus_HEADERS} )
target_link_libraries(dbus-1 ${LIBS})
if(MSVC)
set(DEF_LIBRARY_NAME dbus-1.dll)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/dbus-1.def.cmake" "${CMAKE_BINARY_DIR}/dbus-1.def")
set(DEF_LIBRARY_NAME dbus-1d.dll)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/dbus-1.def.cmake" "${CMAKE_BINARY_DIR}/dbus-1d.def")
set_target_properties(dbus-1 PROPERTIES LINK_FLAGS_RELWITHDEBINFO /def:"${CMAKE_BINARY_DIR}/dbus-1.def")
set_target_properties(dbus-1 PROPERTIES LINK_FLAGS_RELEASE /def:"${CMAKE_BINARY_DIR}/dbus-1.def")
set_target_properties(dbus-1 PROPERTIES LINK_FLAGS_MINSIZEREL /def:"${CMAKE_BINARY_DIR}/dbus-1.def")
set_target_properties(dbus-1 PROPERTIES LINK_FLAGS_DEBUG /def:"${CMAKE_BINARY_DIR}/dbus-1d.def")
endif(MSVC)
if(MSVC_IDE)
project_source_group(${GROUP_CODE} libdbus_SOURCES libdbus_HEADERS)
endif(MSVC_IDE)
endif(splitlib AND MSVC)
target_link_libraries(dbus-1 ${LIBS} )
install_targets(/lib dbus-1 )
install_files(/include/dbus FILES ${dbusinclude_HEADERS})
if(NOT splitlib)
install_targets(/lib dbus-1 )
install_files(/include/dbus FILES ${dbusinclude_HEADERS})
endif(NOT splitlib)
#ADD_EXECUTABLE(dbus-example dbus-example.c)
#target_link_libraries(${CMAKE_SOURCE_DIR}/../dbus/dbus-example dbus-1)
......@@ -254,7 +296,7 @@ install_files(/include/dbus FILES ${dbusinclude_HEADERS})
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 ${LIBS})
target_link_libraries(dbus-test ${DBUS_1} ${LIBS})
add_test(dbus-test ${EXECUTABLE_OUTPUT_PATH}/dbus-test ${CMAKE_SOURCE_DIR}/../test/data)
#install_targets(/bin dbus-test)
ENDIF (DBUS_BUILD_TESTS)
......
This diff is collapsed.
project(test)
#if HAVE_GLIB
# GLIB_SUBDIR=glib
......@@ -16,9 +17,6 @@ add_subdirectory( name-test )
#INCLUDES=-I$(top_srcdir) $(DBUS_test-CFLAGS)
include_directories( ${CMAKE_SOURCE_DIR}/.. )
include_directories( ${CMAKE_INCLUDE_PATH} )
if (WIN32)
add_definitions(-Dsleep=_sleep)
endif (WIN32)
......@@ -89,7 +87,7 @@ set (decode_gcov_SOURCES
)
add_executable(test-service ${test-service_SOURCES})
target_link_libraries(test-service dbus-1)
target_link_libraries(test-service ${DBUS_1})
#install_targets(/bin test-service)
# (rh) does not work at now
......@@ -98,63 +96,68 @@ ADD_TEST(test-service ${EXECUTABLE_OUTPUT_PATH}/test-service${EXT})
add_executable(test-names ${test-names_SOURCES})
target_link_libraries(test-names dbus-1)
target_link_libraries(test-names ${DBUS_1})
#install_targets(/bin test-names)
ADD_TEST(test-names ${EXECUTABLE_OUTPUT_PATH}/test-names${EXT})
add_executable(test-shell ${test-shell_SOURCES})
target_link_libraries(test-shell dbus-1)
target_link_libraries(test-shell ${DBUS_1})
#install_targets(/bin test-shell)
ADD_TEST(test-shell ${EXECUTABLE_OUTPUT_PATH}/test-shell${EXT})
add_executable(test-shell-service ${test-shell_SOURCES})
target_link_libraries(test-shell-service dbus-1)
target_link_libraries(test-shell-service ${DBUS_1})
#install_targets(/bin test-shell-service)
ADD_TEST(test-shell-service ${EXECUTABLE_OUTPUT_PATH}/test-shell-service${EXT})
add_executable(test-spawn ${test-spawn_SOURCES})
target_link_libraries(test-spawn dbus-1)
target_link_libraries(test-spawn ${DBUS_1})
# (rh) does not work now
#ADD_TEST(test-spawn ${EXECUTABLE_OUTPUT_PATH}/test-spawn${EXT})
add_executable(test-exit ${test-exit_SOURCES})
target_link_libraries(test-exit dbus-1)
target_link_libraries(test-exit ${DBUS_1})
#install_targets(/bin test-exit)
ADD_TEST(test-exit ${EXECUTABLE_OUTPUT_PATH}/test-exit${EXT})
add_executable(test-segfault ${test-segfault_SOURCES})
target_link_libraries(test-segfault dbus-1)
target_link_libraries(test-segfault ${DBUS_1})
#install_targets(/bin test-segfault)
ADD_TEST(test-segfault ${EXECUTABLE_OUTPUT_PATH}/test-segfault${EXT})
add_executable(test-sleep-forever ${test-sleep-forever_SOURCES})
target_link_libraries(test-sleep-forever dbus-1)
target_link_libraries(test-sleep-forever ${DBUS_1})
# (rh) don't know for what this test is good
#ADD_TEST(test-sleep-forever ${EXECUTABLE_OUTPUT_PATH}/test-sleep-forever${EXT})
#add_executable(decode-gcov ${decode_gcov_SOURCES})
#target_link_libraries(decode-gcov dbus-1)
#target_link_libraries(decode-gcov ${DBUS_1})
#EXTRA_DIST=
#
### keep these in creation order, i.e. uppermost dirs first
set (TESTDIRS
test/data
test/data/valid-messages
test/data/invalid-messages
test/data/incomplete-messages
test/data/auth
test/data/sha-1
test/data/valid-config-files
test/data/valid-config-files/basic.d
test/data/valid-config-files/system.d
test/data/valid-service-files
test/data/invalid-config-files
test/data/equiv-config-files
test/data/equiv-config-files/basic
test/data/equiv-config-files/basic/basic.d
test/data/equiv-config-files/entities
test/data/auth
test/data/equiv-config-files
test/data/equiv-config-files/basic
test/data/equiv-config-files/basic/basic.d
test/data/equiv-config-files/entities
test/data/equiv-config-files/entities/basic.d
test/data/incomplete-messages
test/data/invalid-config-files
test/data/invalid-config-files-system
test/data/invalid-messages
test/data/invalid-service-files-system
test/data/sha-1
test/data/valid-config-files
test/data/valid-config-files/basic.d
test/data/valid-config-files/system.d
test/data/valid-config-files-system
test/data/valid-introspection-files
test/data/valid-messages
test/data/valid-service-files
test/data/valid-service-files-system
)
set (CONFIG_VERBOSE 0)