Failing to build foo.C (captital C) as C code when using LANGUAGE property
If you have a source with extension C (capital C), by default CMake wants to build this as C++ code. If you want to build this as C code instead, the usual advice is to use:
set_source_files_properties(foo.C PROPERTIES LANGUAGE C)
When using clang (Xcode 8.3), this results in using cc binary instead of c++ binary (i.e. CMAKE_C_COMPILER instead of CMAKE_CXX_COMPILER, and CMAKE_C_FLAGS* instead of CMAKE_CXX_FLAGS* are used).
However that binary will also determine the C/C++ language mode based on the file extension and the foo.C source still gets built in C++ mode. The only way to fix this is to explicitly add "-x c" compiler flag. Isn't this something what CMake can do by default when LANGUAGE property is explicitly set to a different value than what you would derive from the source extension ?