How to compile linear assemble?

/usr/share/cmake/Modules/Compiler/TI-ASM.cmake:

include(Compiler/TI)
__compiler_ti(ASM)

set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm;s;abs)

However, TI has a special assemble named linear assemble:

$ cl6x --help
...
Default File Extensions Options:
  --ap_extension,-el=.ext      Extension for linear asm files (default is .sa)
  --asm_extension,-ea=.ext     Extension for assembly files (default is .asm)
  --c_extension,-ec=.ext       Extension for C files (default is .c)
...

I try to list(APPEND CMAKE_ASM_SOURCE_FILE_EXTENSIONS sa), but it still not work. cmake --build build will not compile *.sa.

code is here.

We can add to the extension list (there’s also a regex that does some filtering). However, manually setting the source file’s LANGUAGE property should override any such behaviors.

The problem is how to distinguish *.asm and *.ap? *.asm need --asm_extension, *.ap need --ap_extension. However, in /usr/share/cmake/Modules/Compiler/TI.cmake:

set(__COMPILER_TI_SOURCE_FLAG_ASM "--asm_file")

So how to solve this problem? Is it

Create a new language named such as AP:

set(CMAKE_AP_SOURCE_FILE_EXTENSIONS sa)
set(__COMPILER_TI_SOURCE_FLAG_AP "--ap_file")

I guess it should be added as assembler dialect. CMake has support for that (e.g. choosing NASM or MASM), which makes it easier than a complete new language.

Here’s a prototype branch you can try out.

If that work, I guess the next step would be to open an issue to discuss any details. e.g. I’m unsure how to name the dialect.