Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is CMake ignoring assembly files when building static library?

I've set

set(CAN_USE_ASSEMBLER TRUE)

And it's not helping at all. I'm trying to create a static library with a command like:

add_library(${CMAKE_PROJECT_NAME} STATIC ../PropWare ../spi ../spi_as.S ../sd)

where the files without extensions are C++ or C files and the .S file is assembly. But when I run cmake and make, it compiles the C/C++ sources and just ignores the assembly file... no warnings, no errors... just skips right over it.

I'd love any ideas. Full source is available on github (do note: this link is to the cmake branch, all others should be ignored). The first line is in this file and the second line is in this file.

Thanks, David

like image 818
DavidZemon Avatar asked May 04 '14 02:05

DavidZemon


1 Answers

Update

See this better answer https://stackoverflow.com/a/67902603/2784641 It's not always possible to know what languages you need enabled at the time that the project() command is invoked... but probably 99.9% of the time it is, so go with this route. If, however, you need to programmatically enable different languages, based on some configure-time logic, then my original answer will work for you.

Original Answer

Finally found it. Instead of

set(CAN_USE_ASSEMBLER TRUE)

I should have used

enable_language(ASM)
like image 156
DavidZemon Avatar answered Sep 27 '22 17:09

DavidZemon