Commit graph

33 commits

Author SHA1 Message Date
Ralf Habacker
f075650634 cmake: in macro generate_compiler_warning_flags prevent duplicates in variable containing unsupported warnings
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-04-21 13:51:55 +00:00
Ralf Habacker
fb5449e08f cmake: Fix detecting -Wformat-* warnings for gcc
gcc expects -Wformat to be set along with these type of warnings.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-04-21 13:51:55 +00:00
Ralf Habacker
bbd3f90a8d cmake: Fix not detecting unsupported g++ related warning checks
Unsupported warnings are detected by cmake through errors during
compilation, which causes g++ not to detect them, since they are
only output as warnings. Setting -Werror ensures this.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-04-21 13:51:55 +00:00
Alex Richardson
d35554c111 cmake: Only add warning flags if the compiler supports them
I am compiling for FreeBSD where the compiler is Clang and doesn't accept
all the GCC warning flags. This breaks the -Werror build:
```
error: unknown warning option '-Wduplicated-branches' [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wduplicated-cond' [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wjump-misses-init' [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wlogical-op'; did you mean '-Wlong-long'? [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wrestrict' [-Werror,-Wunknown-warning-option]
error: unknown warning option '-Wunused-but-set-variable'; did you mean '-Wunused-const-variable'? [-Werror,-Wunknown-warning-option]
```

With this change we use check_{c,cxx}_compiler_flag to check if the flag
is supported before adding it. In the future this will allow adding
clang-specific warning flags to the list of warnings as well since they
will be ignored for GCC.
2022-03-29 12:21:46 +00:00
Ralf Habacker
667b153dce cmake: Make gcc builds use similar compiler warnings to autotools
Fixes #356
2021-12-10 13:36:28 +00:00
Ralf Habacker
b76c46437e cmake: add macro add_unit_test to reduce code duplication
This macro is now used by add_test_executable and
add_session_test_executable.
2020-11-26 10:46:34 +01:00
Ralf Habacker
97bdefd4e2 cmake: Add support for systemd integration on Linux operating systems
Previously, only the Autotools build system could do this. This commit
includes most of the same features as in the Autotools build, although
not the user-session semantics, which will be added separately.

Systemd support is controlled by the cmake variable ENABLE_SYSTEMD, which can
have the values OFF, ON and AUTO, the latter enabling support by default if
the required libraries are available.

With WITH_SYSTEMD_SYSTEMUNITDIR a custom installation location can be specified.
If it is not specified, the related install path is determined from the installed
systemd package, if present.
2020-06-10 18:13:47 +00:00
Ralf Habacker
eb6d4a1439 cmake: Add macro check_auto_option() as an addition to add_auto_option()
check_auto_option() checks the values given to an auto-option and prints
a fatal error in case of invalid combinations.
2020-06-10 18:13:47 +00:00
Ralf Habacker
ab404c5ffb cmake: rename tristateoption() to add_auto_option() and make signature compatible to option() 2020-06-10 18:13:47 +00:00
Ralf Habacker
6e8d75834e Add support to generate the api documentation in Qt help format
Qt help files are used by Qt Creator and KDevelop, for example, to support
the development of Qt-based applications and libraries.

Generating api documentation in Qt help format is controlled by two
user specific options named --enable-qt-help and --with-qchdir (autotools)
and -DENABLE_QT_HELP and -DINSTALL_QCH_DIR (cmake).
2020-04-29 15:23:23 +00:00
Ralf Habacker
8ffe1b949c cmake: Fix attribute 'original file name' in shared dbus library file info on Windows
The 'original filename' attribute was 'libdbus-1-3}.dll' with an unwanted
curly bracket.
2020-02-19 23:41:08 +01:00
Ralf Habacker
54800ede4e Remove obsolete parameter in end... cmake keywords 2019-01-23 21:34:24 +01:00
Ralf Habacker
382857a265 Remove spaces between cmake command and opening bracket 2019-01-23 21:34:24 +01:00
Ralf Habacker
a8e5e5c552 Add cmake macros add_executable_version_info and add_library_version_info
This helps to reduce duplicated code.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2019-01-22 09:58:27 +01:00
Ralf Habacker
3bf97922bd Move cmake related build system to top level
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2019-01-22 09:57:40 +01:00
Ralf Habacker
7f9eb9cea8 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.
2019-01-10 20:19:04 +01:00
Ralf Habacker
578ea41d8c Add cmake support for session based test executables
This patch introduces a new cmake macro add_session_test_executable,
which uses dbus-run-session to start a dbus-daemon process with a
temporary session bus in the background and the desired client file.

add_session_test_executable requires additional environment variables
defined in the top level CMakeLists.txt.

Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/135
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2018-12-17 16:25:12 +01:00
Ralf Habacker
a9e25f06c8 Use prefined variables to setup environment in cmake macro add_test_executable
Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/135
2018-12-17 16:25:12 +01:00
Ralf Habacker
56171457fb Add new cmake configure option DBUS_USE_WINE
If this variable is set, ctest uses wine to run cross compiled
test applications. Otherwise, they are assumed to run on a native
Windows operating system.

The new cmake variables Z_DRIVE_IF_WINE and TEST_WRAPPER have been
added to support this function.
2018-12-06 09:18:27 +01:00
Ralf Habacker
0c0e7361ae Adds uac manifest to all executable test files to prevent the Windows 740 error when running
The case occurred during test-pending-call-dispatch. To avoid further
applications being affected in the future, the manifest is added to
all test applications.

Windows Error 740 is defined as 'The Requested Operation Requires Elevation'
2018-12-05 15:58:48 +01:00
Ralf Habacker
b59ff3d223 Fix cmake 3.5 configure error on opening a non existant file
Previous cmake versions seemed to be more tolerant.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103015
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
Reviewed-by: Simon McVittie <smcv@collabora.com>
2017-10-18 19:20:02 +02:00
Ralf Habacker
191da55a72 Use cmake build in timestamp function to generate the build time stamp
The recent implementation generates a timestamp containing eol on
linux hosts, which generates unparseable versioninfo.rc.

This commit raises the minimal required cmake version to 3.0.2.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=103015
Reviewed-by: Simon McVittie <smcv@collabora.com>
2017-10-18 15:22:04 +02:00
Simon McVittie
cc1ee6c39d test/dbus-daemon: Exercise the Peer interface
We have to skip the GetMachineId() part during build-time testing
if it wouldn't work - there is no guarantee that dbus has ever been
installed on the build system. However, we can insist on it during
installed-tests, if we make sure to complete the installation for the
Travis-CI build by running dbus-uuidgen.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101257
2017-06-08 17:00:38 +01:00
Simon McVittie
36fcd43005 Pass in DBUS_TEST_EXEC via environment, not hard-coded into binaries
This avoids "capturing" the build directory in the built binaries
when built with embedded tests, which is good for reproducible builds.
See <https://reproducible-builds.org/> for more information.

Signed-off-by: Simon McVittie <smcv@debian.org>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100692
2017-04-18 17:20:30 +01:00
Simon McVittie
c7f3df0271 Replace $DBUS_USE_TEST_BINARY with $DBUS_TEST_DBUS_LAUNCH
Instead of using $DBUS_USE_TEST_BINARY to control whether to use the
hard-coded test binary TEST_BUS_LAUNCH_BINARY, we can just use
$DBUS_TEST_DBUS_LAUNCH to control what we launch directly, as we
were already doing for $DBUS_TEST_DAEMON.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92899
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2016-02-12 15:26:23 +00:00
Ralf Habacker
15006d7d12 Refactored cmake part dealing with compiler warnings to use warnings identifier.
It is now possible to use msvc warnings identifiers
(e.g. '4114') or gcc warnings keys (e.g. 'pointer-sign').

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93069
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-02-11 23:26:50 +01:00
Ralf Habacker
93895bc3a5 Do not require binfmt support for running cross compiled test applications.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88966
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2016-02-08 23:16:23 +01:00
Simon McVittie
9c3034f125 cmake: run all automated tests with --tap for better diagnostics
For GLib-based tests it's useful, because it means g_test_message()
gets logged. For the embedded tests it's now accepted and ignored.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=93194
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2015-12-02 00:53:00 +01:00
Ralf Habacker
c39722e286 Give cmake users some hints/requirements when cross compiling for Windows on Linux.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41252
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-21 21:09:55 +01:00
Simon McVittie
7457a44011 tests: don't block and wait for a debugger on abort
In general, I think developers running the tests would expect
them to terminate rather than hanging. Developers who want to debug
such an abort by attaching a debugger to a live process can still set
DBUS_BLOCK_ON_ABORT in the environment.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41252
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
2014-01-10 01:36:16 +01:00
Ralf Habacker
8e728f36d1 Use macros for test and helper executable targets on cmake build system.
The new macros add_test_executables and add helper_executables provides a
platform independent way for specifing dbus test and service applications.

On native Windows and Linux/UNIX systems the test applications are
directly runable.

When cross compiling for Windows on Linux test applications could be
executed on the Linux host system with the help of wine and activated
binfmt_misc support for wine.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41252
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2014-01-10 01:24:56 +01:00
Ralf Habacker
29a27c47e6 Fixed cmake cross compile timestamp creating.
We only need to distinct "Windows" from unix like systems

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59733
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-02-12 10:58:27 +00:00
Ralf Habacker
e41d163083 cmake fix: generate build timestamp
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=41029
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2011-09-22 19:55:13 +02:00