alexfsx
alexfsx

Reputation: 125

How to add FASM support to CMake

does anyone know how to add FASM support to CMake? I've tried an original guide here , but it doesn't work for me.

Upvotes: 2

Views: 661

Answers (2)

Dmitry Mikushin
Dmitry Mikushin

Reputation: 1913

@alexfsx 's answer works perfectly, do not forget to add enable_language(ASM_FASM) into CMakeLists.txt. In this case it's also better to keep *.cmake files with project by placing them to e.g. cmake subfolder and adding it to the module search path:

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

Upvotes: 3

alexfsx
alexfsx

Reputation: 125

So , I managed to add three files as said here in my CMake\share\cmake-3.7\Modules\ directory (I'm using Windows ):

  • CMakeDetermineASM_FASMCompiler.cmake :

    set(ASM_DIALECT "_FASM")
    set(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST fasm)
    include(CMakeDetermineASMCompiler)
    set(ASM_DIALECT)
    
  • CMakeTestASM_FASMCompiler.cmake:

    set(ASM_DIALECT "_FASM")
    include(CMakeTestASMCompiler)
    set(ASM_DIALECT)
    
  • CMakeASM_FASMInformation.cmake:

    set(ASM_DIALECT "_FASM")
    set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;asm)
    set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <SOURCE> <OBJECT>")
    include(CMakeASMInformation)
    set(ASM_DIALECT)
    

Do not forget to include FASM directory to your Path variable

And it works gracefully!

Upvotes: 4

Related Questions