summaryrefslogtreecommitdiff
path: root/cmake
Commit message (Collapse)AuthorAgeFilesLines
* cmake: add missing HAVE_SYS_SYSCALL_H defineLuca Boccassi2023-03-201-0/+1
| | | | Signed-off-by: Luca Boccassi <bluca@debian.org>
* Fix SPDX license reference in FindGLIB2Simon McVittie2022-11-291-1/+1
| | | | | | | The `.txt` here was unnecessary. Fixes: d6abc1da "cmake: Add BSD-style licenses" Signed-off-by: Simon McVittie <smcv@collabora.com>
* cmake: Add BSD-style licensesSimon McVittie2022-11-294-23/+4
| | | | | | | | I've erred on the side of caution and treated the COPYING-CMAKE-SCRIPTS license (a BSD-3-Clause variation) as its own distinct license. Co-authored-by: Ralf Habacker <ralf.habacker@freenet.de> Signed-off-by: Simon McVittie <smcv@collabora.com>
* test: Export G_TEST_BUILDDIR, G_TEST_SRCDIRSimon McVittie2022-10-051-0/+2
| | | | | | | | | | | | | | These environment variables are used by GLib's g_test_build_filename() and related convenience functions, which make it easier for unit tests to find data files in a way that works for both build-time tests and "as-installed" tests. During "as-installed" testing, both variables will normally be unset, and GLib uses the directory containing the executable. In most cases that results in the right thing happening, and this will also be true for dbus, since we install the test executables in ${libexecdir}/installed-tests, helper executables in the same place, and test data in ${libexecdir}/installed-tests/data. Signed-off-by: Simon McVittie <smcv@collabora.com>
* dbus-message.c: skip 1.10 layout compatibility test on new architecturesAlex Richardson2022-09-211-0/+2
| | | | | | | These static assertions fail on CHERI-enabled architectures such as Arm Morello, where pointers are 128 bits. Architectures with 128-bit pointers were not supported in DBus 1.10, so we can skip the checks for DBus 1.10 structure layout compatibility for architectures with pointer size > 64 bit.
* cmake: define DBUS_TEST_SOCKET_DIR in the config headerAlex Richardson2022-09-151-0/+2
| | | | This matches autotools.
* dbus-sysdeps-util-unix.c: Avoid including sys/syslimits.hAlex Richardson2022-08-102-4/+0
| | | | | | | This header is GCC specific header that on my system just contains `#include_next <limits.h>`. FreeBSD also provides this header but it contains a `#warning` that it should not be used. Replace the one use with `#include <limit.h>` and drop the configure checks.
* Use project relative paths in CMake filesJordan Williams2022-07-253-10/+10
| | | | | | | This makes it possible for projects to incorporate D-Bus as a CMake sub-project in a larger CMake project. Before this PR, doing so would result in many errors. This is because CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR would point to directories above the D-Bus project. Using paths relative to the project directory, PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR, corrects for this.
* build: Assume stdint.h is providedSimon McVittie2022-07-192-4/+0
| | | | | | | We now require a (mostly-)C99 compiler, meaning we can rely on having Standard C stdint.h. Signed-off-by: Simon McVittie <smcv@collabora.com>
* Remove fallback implementation of strtoll(), strtoull()Simon McVittie2022-07-192-14/+0
| | | | | | | We now require a (mostly-)C99 compiler, which guarantees the presence of these functions. Signed-off-by: Simon McVittie <smcv@collabora.com>
* cmake: Stop redefining snprintf() to _snprintf() on MSVCSimon McVittie2022-07-191-1/+0
| | | | | | | We now require a mostly-C99 compiler like MSVC 2015, which provides Standard C snprintf(). Signed-off-by: Simon McVittie <smcv@collabora.com>
* Remove emulation of va_copy() in non-C99 compilersSimon McVittie2022-07-192-51/+0
| | | | | | | dbus now requires a (mostly-)C99 compiler, which guarantees the presence of Standard C va_copy(). Signed-off-by: Simon McVittie <smcv@collabora.com>
* build: Remove support for emulating inline with __inline or __inline__Simon McVittie2022-07-191-4/+0
| | | | | | | We now require a (mostly-)C99 compiler, and C99 guarantees the presence of the inline keyword. Signed-off-by: Simon McVittie <smcv@collabora.com>
* build-sys: check for afunix.hMarc-André Lureau2022-07-152-0/+2
| | | | Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* cmake: drop DBUS_VERBOSE_C_SMarc-André Lureau2022-07-131-7/+0
| | | | | | Apparently, not used anywhere. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* cmake: drop unused HAVE_VASPRINTF/HAVE_VSNPRINTF checksMarc-André Lureau2022-07-132-6/+0
| | | | Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* cmake/autotools: remove HAVE_DIRFD/HAVE_DDFDMarc-André Lureau2022-07-132-32/+0
| | | | | | dirfd() is assumed to be present on Linux, dd_fd is never used. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* cmake: drop needless headers checksMarc-André Lureau2022-07-132-38/+0
| | | | Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* build: Add machine-readable licensing markers to the Meson build systemSimon McVittie2022-07-131-0/+1
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* cmake: Generate the same DBus1Config with Meson as with AutotoolsSimon McVittie2022-07-131-1/+1
| | | | | | | | DBus1Config.cmake.in relies on DBus1Targets.cmake, which is generated by CMake. DBus1Config.pkgconfig.in uses pkg-config and is independent of CMake. Signed-off-by: Simon McVittie <smcv@collabora.com>
* Add Meson build systemFélix Piédallu2022-07-131-0/+43
| | | | | Signed-off-by: Félix Piédallu <felix@piedallu.me> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* build-sys: drop DBUS_CMAKEMarc-André Lureau2022-06-171-3/+0
| | | | | | TEST_LISTEN is defined by the cmake/autotools (or meson) build systems. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* cmake: Check for setresuid and getresuidAlex Richardson2022-05-252-0/+4
| | | | | This was not being checked, so the codepaths using the define were never included.
* cmake: drop -DDBUS_CONSOLE_AUTH_DIR=Marc-André Lureau2022-05-191-1/+0
| | | | Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* cmake: Fix definition of DBUS_USE_SYNCAlex Richardson2022-05-162-2/+2
| | | | | | | dbus-sysdeps-unix.c checks for DBUS_USE_SYNC using 0/1 checks not defined checks, so we should be using #cmakedefine01. This fixes lots of -Wundef warnings when compiling for FreeBSD and ensures that we actually use atomics instead of the pthread fallback there.
* cmake: in macro generate_compiler_warning_flags prevent duplicates in ↵Ralf Habacker2022-04-211-3/+4
| | | | | | variable containing unsupported warnings Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
* cmake: Fix detecting -Wformat-* warnings for gccRalf Habacker2022-04-211-0/+3
| | | | | | gcc expects -Wformat to be set along with these type of warnings. Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
* cmake: Fix not detecting unsupported g++ related warning checksRalf Habacker2022-04-211-0/+2
| | | | | | | | 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>
* sysdeps: On Linux, wrap close_range syscall directly if necessarySimon McVittie2022-04-211-0/+1
| | | | | | | | | This was added to the Linux kernel in version 5.9, but the wrapper wasn't added to glibc until 2.34. Adding our own wrapper for the system call means we can use close_range() on Debian 11 and contemporary distributions. Signed-off-by: Simon McVittie <smcv@collabora.com>
* sysdeps: Include <linux/close_range.h> if availableSimon McVittie2022-04-211-0/+1
| | | | | | | This lets us use CLOSE_RANGE_CLOEXEC whenever the kernel headers support it, even if glibc doesn't include this header via unistd.h yet. Signed-off-by: Simon McVittie <smcv@collabora.com>
* sysdeps: Use close_range() if availableSimon McVittie2022-04-212-0/+4
| | | | | | | | | The version with no flags set, which is a slight generalization of closefrom(), is available on recent Linux and FreeBSD. The version with CLOSE_RANGE_CLOEXEC is Linux-specific. Signed-off-by: Simon McVittie <smcv@collabora.com>
* Use closefrom() to not loop over all possible file descriptorsrim2022-04-212-0/+4
| | | | Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/278
* build: Define DBUS_INT64_MODIFIER, analogous to G_GINT64_MODIFIERSimon McVittie2022-04-191-0/+9
| | | | | | | | | | | | | | | | | | | Using PRId64, etc. to print dbus_int64_t or dbus_uint64_t is not 100% portable. On platforms where both long and long long are 64-bit (such as Linux and macOS), we will prefer to define dbus_int64_t as long. If the operating system has chosen to define int64_t as long long, which is apparently the case on macOS, then the compiler can warn that we are passing a long argument to PRId64, which is "lld" and therefore expects a long long argument (even though that ends up with the same bit-pattern being used). We can't necessarily just use int64_t and uint64_t directly, even if all our supported platforms have them available now, because swapping dbus_int64_t between long and long long might change C++ name mangling, causing ABI breaks in third-party libraries if they define C++ functions that take a dbus_int64_t argument. Signed-off-by: Simon McVittie <smcv@collabora.com>
* cmake: Look for dbus-arch-deps.h next to DBus1Config.cmakeSimon McVittie2022-03-301-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | <dbus/dbus-arch-deps.h> is architecture-dependent, and compilers have not traditionally supported an installation path for architecture-specific headers (Debian-based systems have /usr/include/${multiarch_tuple}, but that isn't portable beyond Debian). When dbus was built using Autotools, dependent projects that use CMake need to look for this header in the right place. Unfortunately, it seems that at least recent versions of CMake will ignore the HINTS we get from pkg-config if they are told to search in a non-standard prefix via ${DBus1_ROOT}. Look for dbus-arch-deps.h in a directory derived from the filename of the CMake config file, before trying the normal search algorithm. The CMake config file is in ${libdir}, and so is the architecture-specific header, so this should work reasonably reliably. According to the CMake documentation, if we search for the same thing multiple times, the first successful result will be used; and searching with NO_DEFAULT_PATH is the official way to prepend things to the search order. Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/314 Signed-off-by: Simon McVittie <smcv@collabora.com>
* cmake: Only add warning flags if the compiler supports themAlex Richardson2022-03-291-12/+40
| | | | | | | | | | | | | | | | | | 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.
* cmake: Detect backtrace() support on platforms such as FreeBSDAlex Richardson2022-03-241-1/+3
| | | | | | | | On FreeBSD use of backtrace requires linking libexecinfo. The current check_symbol_exists() will fail due to that missing library. Fortunately, CMake ships with a FindBacktrace module (at least since 3.0) that can be used to correctly handle platforms such as FreeBSD (and OpenBSD according to the FindBacktrace source).
* cmake: setup variable WORDS_BIGENDIAN correctlyRalf Habacker2022-03-021-0/+3
| | | | | | | | | Since version 3.0 cmake provides the macro test_big_endian for that purpose. fixes #375 Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
* build: Opt out from using mingw-w64's replacement printf(), etc.Simon McVittie2022-02-271-0/+9
| | | | | | | | | | | | | | | The Windows code in dbus is careful to use Windows-specific equivalents of the Standard C features that are not implemented by msvcrt.dll, so we don't need to substitute a Standard C printf implementation. This avoids compiler warnings/errors when gcc expects us to be using Microsoft printf syntax (`ms_printf` attribute), but newer versions of mingw-w64 expect us to be using GNU or Standard C printf syntax (`gnu_printf` attribute) as a result of `__USE_MINGW_ANSI_STDIO` being enabled by default if not otherwise specified. Resolves: https://gitlab.freedesktop.org/dbus/dbus/-/issues/380 Signed-off-by: Simon McVittie <smcv@collabora.com>
* Disable the Containers interfaceSimon McVittie2021-12-101-1/+0
| | | | | | | | We've had a request for a 1.14.x stable-branch, but the Containers interface is only partially implemented, not yet described in the D-Bus Specification, and not ready to be part of our API guarantees. Signed-off-by: Simon McVittie <smcv@collabora.com>
* cmake: Make gcc builds use similar compiler warnings to autotoolsRalf Habacker2021-12-101-31/+45
| | | | Fixes #356
* cmake: In generated cmake support files get value for DBus1_INCLUDE_DIRS ↵Ralf Habacker2021-11-181-5/+2
| | | | | | | | variable from related cmake target This allows cmake to construct the resulting (relocatable) runtime paths. Fixes dbus/dbus#346
* CMake: Set IMPORTED_IMPLIB propertyJulien Schueller2021-11-181-0/+1
| | | | | Setting this property allows to fix linking to the imported target with MinGW. This only happens when dbus is built using autotools, when cmake is used the DBus1Config.variant.in is configured and the automatically exported target by cmake is fine.
* Add HAVE_DECL_xxx checks to cmake build systemRalf Habacker2021-11-182-0/+6
| | | | | | | The first two definitions are required to fix cmake build error when compiling with -Werror=undef on Windows. The last one completes having HAVE_DECL_xxx definitions.
* Move _GNU_SOURCE to config.h.cmakeRalf Habacker2021-11-181-0/+5
|
* Move DBUS_BUILT_R_DYNAMIC to config.h.cmakeRalf Habacker2021-11-181-0/+3
|
* Fix definition of HAVE_SOCKLEN_TRalf Habacker2021-11-181-1/+1
|
* Add configure checks for vsnprintf and vasprintf to cmake build systemRalf Habacker2021-11-182-0/+6
|
* cmake: fix find_package related naming mismatch for GLIB2Ralf Habacker2021-11-101-0/+0
| | | | | | | | The package name passed to `find_package_handle_standard_args` (GLIB2) did not match the name of the calling package (GLib2). This could lead to problems when calling code that expects `find_package`. result variables (e.g. `_FOUND`) expect to follow a certain pattern. fixes #319
* cmake: add macro add_unit_test to reduce code duplicationRalf Habacker2020-11-261-47/+57
| | | | | This macro is now used by add_test_executable and add_session_test_executable.
* cmake: make support for traditional activation optionalRalf Habacker2020-09-231-0/+1
| | | | | | | | Traditional activation is enabled/disabled with the cmake configure parameter -DENABLE_TRADITIONAL_ACTIVATION, which is enabled by default. This was added to the Autotools build system as part of dbus/dbus!107 but until now was not possible to disable when building with CMake.