Alexander Neundorf wrote:
On Monday 24 August 2009, John Smith wrote:
[...] I have tried doing that. [...]

So you have also hit that bug ?
http://public.kitware.com/Bug/view.php?id=8392


Interesting, did not know of it.

IMHO, I believe that the C compiler (or C compiler driver) should be invoked on the assembly sources, with the exact definitions and C compiler flags that are set at that point in the processing of the source tree. The reason for that is definitions may be involved in pre-processing the source file as conditionals guarding include directives, etc. and flags may alter the code generation, e.g., -m32 may be used to generate x86 code.

If CMake has the concept of a settable "default" language/compiler per project then perhaps that default compiler -- be it C or C++ -- might be the perfect choice for building the project's assembly files. The C compiler would use the compile definitions and C flags, whereas the C++ compiler would use the same definitions but CXX flags. I.e., not hard-coding the C compiler in might be a better choice. Of course, I might be wrong, and I invite others to state their opinions on this.

gcc -- per the man page -- does not preprocess .s files but it does so for .S files, when invoked for compilation. With this behavior, I believe gcc is unique.

Other compilers which I believe know automagically what to do with .s assembly sources are:

1. HP aCC at http://tinyurl.com/nhr97k :

Assembly language source files (.s files)
Files with names ending in .s are assumed to be assembly source files. The compiler invokes the assembler through cc to produce .o files from these.

2. IBM VisualAge for C++ at http://tinyurl.com/l2lqt4 :

Assembler files
Assembler files must have a .s suffix, for example, file_name.s, unless you compile with the -qsourcetype=assembler option. Assembler files are assembled to create an object file.

3. Sun's Sun Studio at http://tinyurl.com/ma6etm :

The syntax of the cc command is:
% cc [options] filenames [libraries]...
[...]
Use the C compiler to compile and link any combination of the following:
[...] o Assembler source files, with .s suffixes

4. Intel C++ at http://tinyurl.com/6lxedl :

The Intel® C++ Compiler recognizes input files with the extensions listed in the following table:

[...]
file.s   |   Assembly file    |     Passed to assembler

Can you please try the attached patch ?

Sure thing, I will.

Thanks!
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to