summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
Commit message (Collapse)AuthorAgeFilesLines
* build: Put system bus socket in runstatedir by defaultIssam E. Maghni2022-10-111-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>
* build: Show a warning if the system bus socket is not interoperableSimon McVittie2022-10-111-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>
* dbus-message.c: skip 1.10 layout compatibility test on new architecturesAlex Richardson2022-09-211-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.
* cmake: Always try to find pkg-configAlex Richardson2022-08-101-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.
* Use project relative paths in CMake filesJordan Williams2022-07-251-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.
* Bump CMake version to 3.4Jordan Williams2022-07-251-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.
* cmake: drop DBUS_VERBOSE_C_SMarc-André Lureau2022-07-131-4/+0
| | | | | | Apparently, not used anywhere. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* cmake: use -gdwarf-2Marc-André Lureau2022-07-061-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>
* cmake: drop -DDBUS_CONSOLE_AUTH_DIR=Marc-André Lureau2022-05-191-8/+0
| | | | Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* cmake: Allow overriding TEST_SOCKET_DIRAlex Richardson2022-05-011-1/+1
| | | | This matches the autotools build where that option can also be overridden.
* cmake: Let the c++ compiler use the warnings available to itRalf Habacker2022-04-211-1/+1
| | | | | | Fixes #387 Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
* Ignore gcc 10.3 'inline' warnings: 'call is unlikely and code size would grow'Ralf Habacker2022-04-211-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>
* cmake: Correct DBUS_{SYSTEM,SESSION}_CONFIG_FILE on UNIX systemsAlex Richardson2022-04-191-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.
* cmake: temporary disable fatal warnings related to new opensuse buildsRalf Habacker2022-03-291-0/+3
| | | | | | This is necessary for these CI builds to be successful. Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
* cmake: Only add warning flags if the compiler supports themAlex Richardson2022-03-291-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.
* cmake: Fix DBUS_SESSION_SOCKET_DIR when cross-compilingAlex Richardson2022-03-291-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.
* cmake: Use -Wl,-export_dynamic when building for macOSAlex Richardson2022-03-241-2/+7
| | | | | The macOS linker does not accept --export-dynamic, so use this alternate spelling.
* cmake: Only pass -Wl,--export-dynamic when linkingAlex Richardson2022-03-241-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.
* Revert "Fix gcc compile error: redundant redeclaration of ‘environ’ ↵Alex Richardson2022-03-191-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.
* cmake: Set DBUS_*_CONFIG_FILE to be in datadir on UnixRalf Habacker2022-03-041-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"
* cmake: setup variable WORDS_BIGENDIAN correctlyRalf Habacker2022-03-021-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>
* cmake: remove obsolete variable DBUS_SOURCE_DIRRalf Habacker2022-02-211-5/+2
| | | | | | This issue has been reported at #377 Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
* cmake: add -fno-common when !MSVCMarc-André Lureau2022-01-211-4/+6
| | | | Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* cmake: fix warnings variablesMarc-André Lureau2022-01-211-3/+3
| | | | | | Do not use strings for compiler flags. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* cmake: do not use gcc specific warning when building with msvcRalf Habacker2022-01-031-1/+4
|
* 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: add option ENABLE_VERBOSE_CONFIGRalf Habacker2021-12-101-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.
* cmake: add configure option 'ENABLE_WERROR' to keep in sync with autotoolsRalf Habacker2021-12-101-0/+5
|
* cmake: Make gcc builds use similar compiler warnings to autotoolsRalf Habacker2021-12-101-12/+83
| | | | Fixes #356
* cmake: use the string 'append' command to add compiler flags for convenienceRalf Habacker2021-12-101-13/+13
| | | | | The minimum version of cmake has been increased because the mentioned string command has been added with cmake 3.4.
* Fix gcc compile error: redundant redeclaration of ‘environ’ ↵Ralf Habacker2021-11-301-0/+5
| | | | | | [-Werror=redundant-decls] Cherry picked from dbus/dbus!227
* cmake: Separate setting compiler warnings between C and CXXRalf Habacker2021-11-181-8/+12
| | | | | This is necessary because different warnings are restricted to one compiler variant.
* Move _GNU_SOURCE to config.h.cmakeRalf Habacker2021-11-181-1/+1
|
* Move DBUS_BUILT_R_DYNAMIC to config.h.cmakeRalf Habacker2021-11-181-1/+1
|
* cmake: take over some fatal warnings from autotoolsRalf Habacker2021-11-181-1/+7
| | | | | Adopt various fatal warnings from the autotools build system to see corresponding build errors also in cmake.
* cmake: fix find_package related naming mismatch for GLIB2Ralf Habacker2021-11-101-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
* cmake: make support for traditional activation optionalRalf Habacker2020-09-231-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.
* cmake: add support for user session semantic on Linux operating systemsRalf Habacker2020-06-101-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.
* cmake: Add support for systemd integration on Linux operating systemsRalf Habacker2020-06-101-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.
* cmake: Let Wine display the correct file name and line numbers for backtracesRalf Habacker2020-05-161-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
* cmake: Fix setting default value for DBUS_BUILD_TESTS too lateRalf Habacker2020-05-041-2/+2
| | | | This prevented setting cross compile support required for !158.
* Add support to generate the api documentation in Qt help formatRalf Habacker2020-04-291-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).
* cmake: remove component 'dev' as we never used that consistentlyRalf Habacker2020-04-291-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.
* Merge branch 'msys2-fixes' into 'master'Simon McVittie2019-03-151-1/+0
|\ | | | | | | | | | | | | cmake: Drop unused iconv dependency Closes #262 See merge request dbus/dbus!101
| * cmake: Drop unused iconv dependencyRalf Habacker2019-03-131-1/+0
| | | | | | | | Closes dbus#262
* | cmake: Enable pkg-config generating also on WindowsRalf Habacker2019-03-131-1/+2
|/ | | | | pkgconfig support is used by client packages on cross compiled obs builds.
* Fixes remaining indentations that are not covered by the cmake formatting ↵Ralf Habacker2019-01-241-8/+11
| | | | script in CMakeLists.txt files
* Adjust indents of CMakeLists.txt files always to 4 spacesRalf Habacker2019-01-241-23/+23
|
* Remove obsolete parameter in end... cmake keywordsRalf Habacker2019-01-241-44/+44
|
* Remove spaces between cmake command and opening bracketRalf Habacker2019-01-241-89/+89
|