summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2019-01-10 15:29:59 +0100
committerRalf Habacker <ralf.habacker@freenet.de>2019-01-10 20:19:04 +0100
commit7f9eb9cea8c2329248bdf98418704b4e2ca450bb (patch)
tree6f207543a6e87aa557709481c8549c7cd007eb0a /cmake
parent85253791ff8b14005988f79ac25a89e36cf9c567 (diff)
downloaddbus-7f9eb9cea8c2329248bdf98418704b4e2ca450bb.tar.gz
Make sure ctest on Windows uses the currently built dbus library
The ctest application is usually not installed in the dbus build directory. If an older dbus library is contained in this path, it will be used instead of the currently built one, which can lead to runtime errors (e.g.: c0000139) if the internal dbus API differs.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/CMakeLists.txt6
-rw-r--r--cmake/modules/Macros.cmake7
2 files changed, 12 insertions, 1 deletions
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 93402e0b..429205b3 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -484,6 +484,12 @@ add_definitions(${DBUS_BUS_CFLAGS})
if (DBUS_BUILD_TESTS)
# set variables used for the .in files (substituted by configure_file) in test/data:
set(DBUS_TEST_EXEC ${Z_DRIVE_IF_WINE}${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${IDE_BIN})
+ # Working directory for build-time tests, so that they'll pick up
+ # the correct libdbus-1-3.dll on Windows.
+ # This happens to be the same as DBUS_TEST_EXEC, but its meaning is
+ # different, and it has no direct Autotools equivalent (Autotools
+ # tests automatically get their own ${builddir} as working directory).
+ set(DBUS_TEST_WORKING_DIR ${Z_DRIVE_IF_WINE}${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${IDE_BIN})
set(DBUS_TEST_DATA ${Z_DRIVE_IF_WINE}${CMAKE_BINARY_DIR}/test/data)
set(DBUS_TEST_DAEMON ${Z_DRIVE_IF_WINE}${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${IDE_BIN}/dbus-daemon${EXEEXT})
set(DBUS_TEST_DBUS_LAUNCH ${Z_DRIVE_IF_WINE}${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${IDE_BIN}/dbus-launch${EXEEXT})
diff --git a/cmake/modules/Macros.cmake b/cmake/modules/Macros.cmake
index 4e635057..3b93eb99 100644
--- a/cmake/modules/Macros.cmake
+++ b/cmake/modules/Macros.cmake
@@ -54,7 +54,11 @@ macro(add_test_executable _target _source)
add_test(NAME ${_target} COMMAND ${TEST_WRAPPER} ${Z_DRIVE_IF_WINE}$<TARGET_FILE:${_target}> --tap)
endif()
else()
- add_test(NAME ${_target} COMMAND $<TARGET_FILE:${_target}> --tap)
+ add_test(
+ NAME ${_target}
+ COMMAND $<TARGET_FILE:${_target}> --tap
+ WORKING_DIRECTORY ${DBUS_TEST_WORKING_DIR}
+ )
endif()
set(_env)
list(APPEND _env "DBUS_SESSION_BUS_ADDRESS=")
@@ -94,6 +98,7 @@ macro(add_session_test_executable _target _source)
--dbus-daemon=${DBUS_TEST_DAEMON}
${Z_DRIVE_IF_WINE}$<TARGET_FILE:${_target}>
--tap
+ WORKING_DIRECTORY ${DBUS_TEST_WORKING_DIR}
)
set(_env)
list(APPEND _env "DBUS_SESSION_BUS_PID=")