Skip to content

Comments

CMakeLists.txt: use GAS by default if building with Clang-CL#328

Open
erikbs wants to merge 1 commit intoboostorg:developfrom
erikbs:patch-1
Open

CMakeLists.txt: use GAS by default if building with Clang-CL#328
erikbs wants to merge 1 commit intoboostorg:developfrom
erikbs:patch-1

Conversation

@erikbs
Copy link
Contributor

@erikbs erikbs commented Jan 31, 2026

if (MSVC) evaluates to true if building with Clang-CL, but at least if cross-compiling with Clang-CL from a non-Windows host, MASM (default for MSVC) is not understood. Using GAS, however, works perfectly. I therefore propose to restrict this check to trigger only with MSVC and not Clang-CL. I have not tested this extensively, but it works in my case where I use Clang-CL on a GNU/Linux host targeting Windows.

Of course another option is to override the detected assembler using -DBOOST_CONTEXT_ASSEMBLER="gas", but automatic detection makes build scripts a bit cleaner.

@microcai
Copy link
Contributor

cross-compiling hates automatic detection.

@erikbs
Copy link
Contributor Author

erikbs commented Feb 24, 2026

It is relevant when building with LLVM/Clang-CL on Windows without cross-compiling as well, I tested.

If configuring through the MSVC Command Prompt, Context will detect MASM/ml64.exe and use that (ignoring CMAKE_ASM_COMPILER if I set it to Clang-CL). If using only CMake + Ninja + LLVM/Clang-CL, it will still try to use ml64.exe, but fail to find it. With my patch, it will both respect CMAKE_ASM_COMPILER and use Clang-CL if no assembler is specified explicitly.

In my opinion my proposed patch therefore makes sense even if we ignore cross-compilation. Instead of defaulting to MASM for all Windows builds, this would make Context default to using the assembler associated with the compiler, so MASM when building with MSVC and Clang-CL/GAS when building with Clang-CL. I think that is cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants