[Pkg-cmake-team] Bug#1117682: debtoolchainfilegen: include *_FOR_BUILD flags in toolchain file

Fabian Greffrath fabian at debian.org
Thu Oct 9 16:58:55 BST 2025


Package: cmake
Version: 4.1.1+really3.31.6-2
Severity: wishlist

Hi there,

the /usr/share/cmake/debtoolchainfilegen tool comes handy to create a
toolchain file for cross-building. However, when cross-building is
involved, it is often a good idea to reset the build flags for the
compilers and linkers - or at least reduce them to a subset that is
known to work on the build architecture.

That's what the *_FOR_BUILD flags are for.

I'd suggest to include these flags in the toolchain file generated by
debtoolchainfilegen, in the same form that they are emitted by
dpkg-buildflags. Either always, or only if a parameter (say '-f') is
additionally given to debtoolchainfilegen.

Example:
set(CMAKE_C_FLAGS "$ENV{CFLAGS_FOR_BUILD} $ENV{CPPFLAGS_FOR_BUILD}")
set(CMAKE_EXE_LINKER_FLAGS "$ENV{LDFLAGS_FOR_BUILD}")


Thanks for considering!

Cheers,

 - Fabian


-- System Information:
Debian Release: forky/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'testing-debug'), (500, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.16.8+deb14-amd64 (SMP w/12 CPU threads; PREEMPT)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages cmake depends on:
ii  cmake-data       4.1.1+really3.31.6-2
ii  libarchive13t64  3.7.4-4+b1
ii  libc6            2.41-12
ii  libcurl4t64      8.16.0-2
ii  libexpat1        2.7.3-1
ii  libgcc-s1        15.2.0-4
ii  libjsoncpp26     1.9.6-4
ii  librhash1        1.4.6-1
ii  libstdc++6       15.2.0-4
ii  libuv1t64        1.51.0-2
ii  procps           2:4.0.4-9
ii  zlib1g           1:1.3.dfsg+really1.3.1-1+b1

Versions of packages cmake recommends:
ii  gcc   4:15.2.0-4
ii  make  4.4.1-2

Versions of packages cmake suggests:
pn  cmake-doc        <none>
pn  cmake-format     <none>
pn  elpa-cmake-mode  <none>
ii  ninja-build      1.12.1-1

-- no debconf information



More information about the Pkg-cmake-team mailing list