Skip to content

ASM_NASM: Fix static library creation with MSVC

Francesco Bertolaccini requested to merge frabert/cmake:fix_nasm_link into master

On Windows using MSVC, a simple project such as this one:

cmake_minimum_required(VERSION 3.16.0)

project(test VERSION 1.0.0 LANGUAGES C CXX ASM_NASM)

add_library(test STATIC test.asm)

fails to link because during the linking step link.exe is called with GNU-style arguments. This MR proposes a fix which involves falling back on the options used for C or CXX static library linking, if present, instead of GNU-style arguments.

Fixes #21877

(Was previously !5865 (closed) but closed due to a git issue)

Edited by Francesco Bertolaccini

Merge request reports