[CMake] assembler support

Gregor Jasny gjasny at googlemail.com
Sun Sep 30 13:48:48 EDT 2007


Hi,

2007/7/2, Alexander Neundorf <a.neundorf-work at gmx.net>:
> since last week cmake cvs has basic support for assembler.
> Assembler is different from other languages in that it actually is no single
> language, but there are many different assembler languages.

thanks for your work in this area! I've started adding nasm support to
my project:

::::::::::::::
CMakeLists.txt
::::::::::::::
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake)
ENABLE_LANGUAGE(ASM-Nasm)
SET(CMAKE_ASM-Nasm_COMPILER_ARG1 -felf)
ADD_EXECUTABLE(test main.cpp bswap.asm)

::::::::::::::
CMake/CMakeASM-NasmInformation.cmake
::::::::::::::
SET(ASM_DIALECT "-Nasm")
SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm)
INCLUDE(CMakeASMInformation)
SET(ASM_DIALECT)

::::::::::::::
CMake/CMakeDetermineASM-NasmCompiler.cmake
::::::::::::::
SET(ASM_DIALECT "-Nasm")
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT nasm)
INCLUDE(CMakeDetermineASMCompiler)
SET(ASM_DIALECT)

::::::::::::::
CMake/CMakeTestASM-NasmCompiler.cmake
::::::::::::::
SET(ASM_DIALECT "-Nasm")
INCLUDE(CMakeTestASMCompiler)
SET(ASM_DIALECT)

I've got still a few questions:
* Object file type: Based on the target code platform, you need to
specify -felf32 (aka. -felf),
  -felf64, -fmacho, etc. as first argument. At the moment this is defined in my
  projects CMakeLists.txt. But I'd like to default to the current
project/file target.
* Generation of debug code: If the build type includes the generation of debug
  information, it would be nice adding '-g' to generate debug
information for assembly
  objects, too.
* Dependency tracking: I've no idea how cmake handles dependencies for
C/C++ at the
  moment, but it would be useful to provide this functionaltity for
assembly files, too.
  nasm can generate Makefile dependencies on stdout with the '-M' switch.

I'd be great to have (at least basic) support for nasm in the 2.5 release.

Thanks,
Gregor


More information about the CMake mailing list