1
0
mirror of https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git synced 2026-10-24 00:48:53 +03:00

build: do not require a C++ compiler if it is not needed

Languages specified in the meson project() function are considered hard
dependencies. When trying to build libgpiod in an environment lacking a
C++ compiler, the build fails with an obscure error message ("ERROR:
Unable to get gcc pre-processor defines").

As the C++ compiler is only needed for building the C++ bindings, do not
require it unless the option bindings-cxx is enabled.

Fixes: 97bab4cc87 ("build: replace autotools with meson & ninja")
Signed-off-by: Edgar Bonet <bonet@grenoble.cnrs.fr>
Link: https://patch.msgid.link/0eb5c26d-731c-4ebb-be34-76466cf57720@grenoble.cnrs.fr
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
This commit is contained in:
Edgar Bonet
2026-08-19 22:13:55 +02:00
committed by Bartosz Golaszewski
parent 7d7b077388
commit 4946370d06

View File

@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# SPDX-FileCopyrightText: 2026 Qualcomm Technologies, Inc. and/or its subsidiaries
project('libgpiod', ['c', 'cpp'],
project('libgpiod', 'c',
version: '2.4',
license: 'LGPL-2.1-or-later',
default_options: [
@@ -56,6 +56,10 @@ opt_dbus = get_option('dbus')
opt_introspection = get_option('introspection')
opt_systemd = get_option('systemd')
if opt_bindings_cxx.allowed()
add_languages('cpp')
endif
if get_option('profiling')
profiling_c_args = ['-fprofile-arcs', '-ftest-coverage']
profiling_link_args = ['-lgcov']