summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
AgeCommit message (Collapse)AuthorFilesLines
2023-08-07Let cmake retrieve version and variable information from meson build systemRalf Habacker1-29/+24
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-10-11build: Put system bus socket in runstatedir by defaultIssam E. Maghni1-2/+2
This lets OS distributors configure --runstatedir=/run if they want to, although for interoperability, they should only do this if they can guarantee that their /run and /var/run are equivalent. A previous commit adds a warning if we are using the default path on a system where /run and /var/run are not synoymous, mitigating the compatibility impact of this change. For CMake, this requires version 3.9, released in 2017. For Meson, this is currently controlled by the runtime_dir option, which defaults to /run if the prefix is /usr. The rationale for this is that /run is correct for modern Unix systems, and distributors who switch from Autotools or CMake to Meson need to review all their build options at that time, which is an ideal opportunity to check that they are doing the right thing around /run. Helps: https://gitlab.freedesktop.org/dbus/dbus/-/issues/180 Co-authored-by: Simon McVittie <smcv@collabora.com>
2022-10-11build: Show a warning if the system bus socket is not interoperableSimon McVittie1-0/+12
We would like to start using ${runstatedir}/dbus/system_bus_socket, so that distributors who make /var/run a symbolic link to /run will usually get their dbus-daemon listening on /run/dbus/system_bus_socket, which has some advantages in corner cases, such as when /var is mediated by an automounter or is unmounted during system shutdown. Unfortunately, the interoperable path in the D-Bus Specification is /var/run/dbus/system_bus_socket for historical reasons (D-Bus is older than /run), and older versions of Slackware are known to have had /run and /var/run as distinct directories. Do a check during configuration to catch systems configured like this and show a warning. When cross-compiling, this assumes that the system where dbus is built (the build system in Autotools/Meson, or the "host" in CMake terminology) has its /var/run and /run set up in a way that is compatible with the system where dbus will run (the host system in Autotools/Meson, or the "target" in CMake terminology). This is not 100% correct, but seems good enough for a warning that will hopefully only trigger for misguided OS distributors. Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-09-21dbus-message.c: skip 1.10 layout compatibility test on new architecturesAlex Richardson1-0/+1
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.
2022-08-10cmake: Always try to find pkg-configAlex Richardson1-1/+5
Commit 97bdefd4e2598e6ea72337acb4230928594bda81 move the include(FindPkgConfig) call into a Linux-specific codepath, so pkg-config was not being detected on FreeBSD. This mean that the check for PKG_CONFIG_FOUND to determine whether to install .pc files later on would always fail and .pc files were not installed on FreeBSD.
2022-07-25Use project relative paths in CMake filesJordan Williams1-27/+27
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.
2022-07-25Bump CMake version to 3.4Jordan Williams1-14/+2
With the minimum version set to 3.4, none of the policies need to be set explicitly to the `NEW` behavior. Each of the policies removed here was introduced before CMake version 3.4. By default then, each of them will be set to NEW automatically. This is part of the behavior of cmake_minimum_required. The cmake_policy commands are therefore redundant and have been removed.
2022-07-13cmake: drop DBUS_VERBOSE_C_SMarc-André Lureau1-4/+0
Apparently, not used anywhere. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-07-06cmake: use -gdwarf-2Marc-André Lureau1-2/+2
GCC 10.2.0 complains on opensuse mingw builds, ex: disable-crash-handling.c: error: STABS debugging information is obsolete and not supported anymore [-Werror] According to https://gitlab.freedesktop.org/dbus/dbus/-/issues/133#note_129599, -gdwarf-2 is the second best option. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-19cmake: drop -DDBUS_CONSOLE_AUTH_DIR=Marc-André Lureau1-8/+0
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-05-01cmake: Allow overriding TEST_SOCKET_DIRAlex Richardson1-1/+1
This matches the autotools build where that option can also be overridden.
2022-04-21cmake: Let the c++ compiler use the warnings available to itRalf Habacker1-1/+1
Fixes #387 Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-04-21Ignore gcc 10.3 'inline' warnings: 'call is unlikely and code size would grow'Ralf Habacker1-0/+1
As long as gcc does something with compatible semantics, it is up to gcc how to optimize our code. The alternative would be to export the functions in question from the shared library, which has the disadvantage of greatly increasing the number of calls across a shared library boundary. Part-of: https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/275 Reviewed-by: Simon McVittie <smcv@collabora.com>
2022-04-19cmake: Correct DBUS_{SYSTEM,SESSION}_CONFIG_FILE on UNIX systemsAlex Richardson1-2/+2
We always install to a dbus-1 subdir, but the path encoded in the binary was missing the dbus-1/ subdirectory, so we end up getting errors when trying to load it.
2022-03-29cmake: temporary disable fatal warnings related to new opensuse buildsRalf Habacker1-0/+3
This is necessary for these CI builds to be successful. Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-03-29cmake: Only add warning flags if the compiler supports themAlex Richardson1-0/+1
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-29cmake: Fix DBUS_SESSION_SOCKET_DIR when cross-compilingAlex Richardson1-1/+7
Inferring it from the environment is not correct, since the host system could have a different temporary directory defined. Instead of guessing based on the host, require the user to pass an explicit directory when cross-compiling. This is helpful for me since I am cross-compiling for FreeBSD from macOS and on my host TMPDIR is set to /var/folders/<random characters>/T/ instead of the expected /tmp.
2022-03-24cmake: Use -Wl,-export_dynamic when building for macOSAlex Richardson1-2/+7
The macOS linker does not accept --export-dynamic, so use this alternate spelling.
2022-03-24cmake: Only pass -Wl,--export-dynamic when linkingAlex Richardson1-2/+2
Otherwise we get the following warnings when building .o files with Clang: clang-13: warning: -Wl,--export-dynamic: 'linker' input unused [-Wunused-command-line-argument] This is required to allow the -Werror build to pass on FreeBSD.
2022-03-19Revert "Fix gcc compile error: redundant redeclaration of ‘environ’ ↵Alex Richardson1-5/+0
[-Werror=redundant-decls]" Breaks the build on FreeBSD which doens't have an environ declaration. The CMake check_symbol_exists call sets `HAVE_DECL_ENVIRON` to an empty variable (which means if(DEFINED) suceeds). This normalization should not be necessary as it will be handled correctly by `#cmakedefine01`. If not, all the other HAVE_* defines would also be wrong. This reverts commit e8b34b419e44e0b95622f45c0f17487e241b1961.
2022-03-04cmake: Set DBUS_*_CONFIG_FILE to be in datadir on UnixRalf Habacker1-4/+2
The files were installed to the datadir (usually /usr/share) since commit 70950325, but the macros used to implement dbus-daemon --system and dbus-daemon --session still looked for them in the sysconfdir (usually /etc). Fixes: 70950325 "Adjust cmake build to match autoconf installation locations"
2022-03-02cmake: setup variable WORDS_BIGENDIAN correctlyRalf Habacker1-0/+4
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>
2022-02-21cmake: remove obsolete variable DBUS_SOURCE_DIRRalf Habacker1-5/+2
This issue has been reported at #377 Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
2022-01-21cmake: add -fno-common when !MSVCMarc-André Lureau1-4/+6
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-01-21cmake: fix warnings variablesMarc-André Lureau1-3/+3
Do not use strings for compiler flags. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-01-03cmake: do not use gcc specific warning when building with msvcRalf Habacker1-1/+4
2021-12-10Disable the Containers interfaceSimon McVittie1-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>
2021-12-10cmake: add option ENABLE_VERBOSE_CONFIGRalf Habacker1-0/+1
Checking the filenames of generated configuration files is now optionally possible with this cmake option. They are no longer displayed by default to avoid unnecessarily flooding the output.
2021-12-10cmake: add configure option 'ENABLE_WERROR' to keep in sync with autotoolsRalf Habacker1-0/+5
2021-12-10cmake: Make gcc builds use similar compiler warnings to autotoolsRalf Habacker1-12/+83
Fixes #356
2021-12-10cmake: use the string 'append' command to add compiler flags for convenienceRalf Habacker1-13/+13
The minimum version of cmake has been increased because the mentioned string command has been added with cmake 3.4.
2021-11-30Fix gcc compile error: redundant redeclaration of ‘environ’ ↵Ralf Habacker1-0/+5
[-Werror=redundant-decls] Cherry picked from dbus/dbus!227
2021-11-18cmake: Separate setting compiler warnings between C and CXXRalf Habacker1-8/+12
This is necessary because different warnings are restricted to one compiler variant.
2021-11-18Move _GNU_SOURCE to config.h.cmakeRalf Habacker1-1/+1
2021-11-18Move DBUS_BUILT_R_DYNAMIC to config.h.cmakeRalf Habacker1-1/+1
2021-11-18cmake: take over some fatal warnings from autotoolsRalf Habacker1-1/+7
Adopt various fatal warnings from the autotools build system to see corresponding build errors also in cmake.
2021-11-10cmake: fix find_package related naming mismatch for GLIB2Ralf Habacker1-1/+1
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
2020-09-23cmake: make support for traditional activation optionalRalf Habacker1-0/+10
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.
2020-06-10cmake: add support for user session semantic on Linux operating systemsRalf Habacker1-0/+10
Systemd user support is controlled by the cmake variable ENABLE_USER_SESSION, which and WITH_SYSTEMD_USERUNITDIR to specify a custom installation location. If WITH_SYSTEMD_USERUNITDIR is not specified, the related install path is determined from an installed systemd package, if present. This was added to the Autotools build system as part of fd.o#61301, but until now was not possible to enable when building with CMake.
2020-06-10cmake: Add support for systemd integration on Linux operating systemsRalf Habacker1-1/+35
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-05-16cmake: Let Wine display the correct file name and line numbers for backtracesRalf Habacker1-0/+5
Wine currently only supports the symbol formats STABS and DWARF 2, but not the other versions, with STABS providing the most information and being the first choice. Since we already use the cmake variable DBUS_USE_WINE for running tests under Wine, we also use it to activate the special symbol format. Closes dbus/dbus/#133
2020-05-04cmake: Fix setting default value for DBUS_BUILD_TESTS too lateRalf Habacker1-2/+2
This prevented setting cross compile support required for !158.
2020-04-29Add support to generate the api documentation in Qt help formatRalf Habacker1-0/+1
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-29cmake: remove component 'dev' as we never used that consistentlyRalf Habacker1-2/+2
Marking targets with a component would only be useful if we marked every target with a component in a consistent way, but because we don't do that, it's pointless to have it in just a few places.
2019-03-15Merge branch 'msys2-fixes' into 'master'Simon McVittie1-1/+0
cmake: Drop unused iconv dependency Closes #262 See merge request dbus/dbus!101
2019-03-13cmake: Enable pkg-config generating also on WindowsRalf Habacker1-1/+2
pkgconfig support is used by client packages on cross compiled obs builds.
2019-03-13cmake: Drop unused iconv dependencyRalf Habacker1-1/+0
Closes dbus#262
2019-01-24Fixes remaining indentations that are not covered by the cmake formatting ↵Ralf Habacker1-8/+11
script in CMakeLists.txt files
2019-01-24Adjust indents of CMakeLists.txt files always to 4 spacesRalf Habacker1-23/+23
2019-01-24Remove obsolete parameter in end... cmake keywordsRalf Habacker1-44/+44