Add tools.build:asmflags consumed by CMakeToolchain (CMAKE_ASM_FLAGS) - #20127
Conversation
Mirror the existing tools.build:cflags/cxxflags handling for assembly: add the tools.build:asmflags conf and CMakeToolchain.extra_asmflags, written to CONAN_ASM_FLAGS and mapped to CMAKE_ASM_FLAGS_INIT (global and per-config).
|
Hi @szostaba Thanks for your contribution. There was already a PR opened for this in #17237.
See the last comment in that PR #17237 (comment) |
|
Hi @memsharded, thanks — I've read #17237 and @jwidauer's thread. Addressing the three open questions directly. 1. Dialects
That's intentional: each dialect is a different assembler with incompatible flag syntax ( 2. Other build systemsCMakeToolchain-only, on purpose. The conf name is build-system-agnostic, so it can be extended later, but I'm not claiming unimplemented support. Precedent: Feasibility: Autotools/Gnu already emit an 3. Risks of breakingFully opt-in: the And nothing is auto-injected: Conan does not add Use case (why not just
|
|
Merged, it will be in next Conan 2.31 release. |
Today
CMakeToolchainsets C/CXX/shared-link/exe-link/RC flags and defines, but nothing populatesCMAKE_ASM_FLAGS. Projects with hand-written assembly (e.g. MCU startup.sfiles) currently have to mirrortools.build:cflagsontoCMAKE_ASM_FLAGSby hand in their recipe. This closes that gap by mirroring the existingtools.build:cflags/cxxflagshandling for assembly:tools.build:asmflagsconf (registered inBUILT_IN_CONFS),CMakeToolchain.extra_asmflagsattribute, for parity withextra_cflags/extra_cxxflags,ExtraFlagsBlockemitsCONAN_ASM_FLAGS;CMakeFlagsInitBlockmaps it toCMAKE_ASM_FLAGS_INIT(both the global and the per-config variants),Scope: CMakeToolchain only — the conf docstring is intentionally CMake-only. Possible follow-ups: AutotoolsToolchain/GnuToolchain parity via the existing
ASFLAGShook (theirasflagsproperty is currently Apple-only and would need theif not is_apple_os: return []guard reworked so flags aren't dropped elsewhere). Meson is out of scope — its generated machine file has no assembly-args slot.Changelog: Feature: Add
tools.build:asmflagsconfig andCMakeToolchain.extra_asmflagsto populateCMAKE_ASM_FLAGS.Docs: Omit
developbranch, documenting this one.