cmake: conditionally enable ASM via check_language to fix MSVC/CMake configuration failures#29
Closed
turbolego wants to merge 0 commit into
Conversation
0d1e269 to
d86eb0b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR fixes a Windows/MSVC configuration failure in
ggmlcaused by unconditional enabling of theASMlanguage in CMake.On modern CMake versions (CMake 4.x / CMP0194 policy behavior), MSVC is not reliably treated as a valid ASM compiler. This leads to early configuration failures such as:
even when a fully functional Visual Studio toolchain is present.
To address this, ASM support is now enabled conditionally using
check_language(ASM), and only activated when the toolchain actually supports it. On MSVC, ASM is skipped while remaining enabled for toolchains where it is supported (GNU, Clang, NASM, etc.).This preserves ASM optimizations where available while fixing Windows/MSVC build reliability issues without globally disabling ASM.
Additional information
This change avoids forcing ASM via:
Instead, ASM is now enabled only when CMake confirms support:
Why this is needed
Recent CMake versions changed ASM handling under policy CMP0194:
enable_language(ASM)may fail early in configurationSince ggml does not require ASM for CUDA / CPU builds on Windows, disabling ASM conditionally avoids breaking configuration while keeping ASM support intact on supported toolchains.
Impact
Requirements