1

I'm trying to run .asm files on Clion, and i've already installed NASM for it but i have a problem with specifying ASM Compiler:

CMake Error at CMakeLists.txt:4 (enable_language):
  The CMAKE_ASM_NASM_COMPILER:

    C:/Users/User/AppData/Local/bin/NASM

  is not a full path to an existing compiler tool.

  Tell CMake where to find the compiler by setting either the environment
  variable "ASM_NASM" or the CMake cache entry CMAKE_ASM_NASM_COMPILER to the
  full path to the compiler, or to the compiler name if it is in the PATH.


mingw32-make.exe: *** [Makefile:175: cmake_check_build_system] Error 1
-- The ASM_NASM compiler identification is unknown
-- Found assembler: C:/Users/User/AppData/Local/bin/NASM
-- Configuring incomplete, errors occurred!

The problem is with this "full path", but i don't quite understand, what is meant with it. Here is my CMakeLists.txt :

cmake_minimum_required(VERSION 3.17)
project(untitled C)
set(CMAKE_ASM_NASM_COMPILER C:/Users/User/AppData/Local/bin/NASM)
enable_language(ASM_NASM)
set(ASM_SOURCES
        test.asm)

set(SOURCES
        ${ASM_SOURCES})

set_source_files_properties(test.asm PROPERTIES LANGUAGE ASM_NASM)

add_executable(program  ${SOURCES})

I've also read similar questions here (but about C/C++ Compiler), they weren't really helpful in my case.

Thank you for the answers!

1 Answers1

1

Solution (using Compile ASM and C with ASM for debugging ) :

cmake_minimum_required(VERSION 3.17)
project(untitled ASM)
enable_language(ASM_NASM)

set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64)
set(CMAKE_ASM_NASM_COMPILE_OBJECT "<CMAKE_ASM_NASM_COMPILER> <INCLUDES> \
    <FLAGS> -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o <OBJECT> <SOURCE>")

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
    set(CMAKE_ASM_NASM_FLAGS "${ASM_NASM_FLAGS} -g")
else()
    set(CMAKE_ASM_NASM_FLAGS "${ASM_NASM_FLAGS}")
endif()


set_source_files_properties(test.asm PROPERTIES LANGUAGE ASM_NASM)

add_executable(program  test.asm)