答案 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")