Mixing C and assembly sources and build with cmake

前端 未结 2 698
囚心锁ツ
囚心锁ツ 2021-01-31 18:28

I\'m using eclipse for building a avr-gcc project that mixes assembly code and C source files. I want to get rid of the automatic makefile generation of eclipse because I need t

2条回答
  •  孤独总比滥情好
    2021-01-31 18:50

    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)
    

提交回复
热议问题