如何为CMake添加FASM支持

时间:2016-11-18 22:54:09

标签: assembly cmake fasm

有谁知道如何向CMake添加FASM支持?我已经尝试过原始导游here,但它对我没用。

2 个答案:

答案 0 :(得分:4)

所以,我设法在我的CMake\share\cmake-3.7\Modules\目录中添加了三个文件here(我使用的是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)
    

不要忘记将FASM目录包含在Path变量

它优雅地运作!

答案 1 :(得分:3)

@alexfsx的答案非常有效,请不要忘记将enable_language(ASM_FASM)添加到CMakeLists.txt。在这种情况下,最好将* .cmake文件与项目放在一起,方法是将它们放在例如cmake子文件夹并将其添加到模块搜索路径:

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