CMake 3.21.0-rc1 broke YASM support
The nasm_add_deps topic introduced generation of GCC-compatible depfiles by the NASM assembler. Unfortunately it closed the door for YASM assembler support because yasm does not support the -MD
and -MT
arguments.
The following testcase reproduces the problem:
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
project(testcase NONE)
find_program(NASM_EXECUTABLE yasm)
set(CMAKE_ASM_NASM_COMPILER ${NASM_EXECUTABLE})
enable_language(ASM_NASM)
add_library(foo foo.asm)
Building results in an error:
ninja -v
[1/2] /opt/homebrew/bin/yasm -MD CMakeFiles/foo.dir/foo.asm.o.d -MT CMakeFiles/foo.dir/foo.asm.o -f macho -o CMakeFiles/foo.dir/foo.asm.o /Users/gregorj/src/cmake-issue-yarn/foo.asm
yasm: warning: can open only one input file, only the last file will be processed
yasm: warning: can open only one input file, only the last file will be processed
CMakeFiles/foo.dir/foo.asm.o: /Users/gregorj/src/cmake-issue-yarn/foo.asm
[2/2] : && /usr/bin/ar cr libfoo.a CMakeFiles/foo.dir/foo.asm.o && /usr/bin/ranlib libfoo.a && :
FAILED: libfoo.a
: && /usr/bin/ar cr libfoo.a CMakeFiles/foo.dir/foo.asm.o && /usr/bin/ranlib libfoo.a && :
ar: CMakeFiles/foo.dir/foo.asm.o: No such file or directory
ninja: build stopped: subcommand failed.
Thanks, Gregor
Edited by Brad King