Weird warning about yasm assembler not found:

Hello everybody,

Some strange warning. I am setting the following in order to have assembler running properly:

set(CMAKE_ASM_COMPILER /usr/local/bin/yasm)
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -f macho64 -m amd64 -o ")

It works fine and processes the assembler files correctly, although during generation I am getting the following messages:


– The ASM compiler identification is YASM
– Found assembler: /usr/local/bin/yasm
– Warning: Did not find file Compiler/YASM-ASM

On one hand the ASM compiler is found, on the other hand yasm compiler is not. Also I did not specified anywhere that I am using yasm beside the path above.

Thanks,
Serge

The assembler was found without real problems.

For some reasons CMake expects a file in the Module path called Compiler/${CMAKE_ASM_COMPILER_ID}-ASM.cmake if you use language ASM without dialects. See https://gitlab.kitware.com/cmake/cmake/-/blob/v3.21.2/Modules/CMakeASMInformation.cmake#L24-29
If a dialect is used or for any other language there is no warning, if such files are missing.

You could try to use ASM_NASM instead of ASM I guess.

@brad.king Is there a reason for this special warning for language ASM only? Or is this just ancient behavior.

I don’t know off the top of my head. Please check git blame.

Thanks Joseph,
can you elaborate about ASM_NASM, how can I set it properly and have the above behavior, i.e. asssembler instruction will be : /usr/bin/yam -f macho64 -m amd64 -o …

Thanks,
Serge

Never used dialects myself. But it should be as simple as using ASM_NASM everywhere instead of ASM.

This little makefile seems to work:

cmake_minimum_required(VERSION 3.10)

project(tryasm LANGUAGES C ASM_NASM)

add_executable(tryasm main.c test.nasm)

During configure it prints out:

-- The ASM_NASM compiler identification is YASM

And it compiles the .nasm file with yasm.