in our project, we have a few .S assembly files which up to now were treated like regular C files (i.e. they were compiled with the same compiler + flags/options as C files). This was achieved by set_source_files_properties(file1.S file2.S PROPERTIES LANGUAGE C) before add_library(foo some.c other.c file1.S file2.S etc.c).
As long as project stated cmake_minimum_required(VERSION 3.17), everything was fine with CMake in version 3.21.3. However, the very same CMake adds -x c to the compile flags when the project uses cmake_minimum_required(VERSION 3.20); in consequence, gcc reports problems with the assembly file.
What is the correct way to tell CMake that the .S files are to be compiled in the same way as C language files (i.e. without adding -x c)?
@marc.chevrier, I admit that declaring the assembler files C language is kind of wrong. However, up to somwhere between cmake_minimum_required(VERSION 3.17) and ... 3.20), this was a successful workaround without having cumbersome constructs like add_custom_command().
Isn’t there some official way to tell CMake “please treat this .S source file in exactly the same way as you would usually do with .c files even if it is no C language file”?
Removing set_source_files_properties(file1.S file2.c PROPERTIES LANGUAGE C) and instead declaring enable_language(ASM) solved my problem. Thanks for your support.