Mixing C and assembly sources and build with cmake

依然范特西╮ 提交于 2019-12-03 01:51:23

CMake 2.8 should support assembler out of the box. Just be sure to enable the "ASM" language in your project. If an assembler source file needs preprocessing, also set the source file's compilation flag:

project(assembler C ASM)
set_source_files_properties(foo.s PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
add_executable(hello foo.s bar.c)

Based on your solution, one of the simplest solutions is this one-liner:

SET(CMAKE_ASM_FLAGS "${CFLAGS} -x assembler-with-cpp")
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!