[CMake] add_custom_command using CMAKE_CXX_FLAGS

Alexander Neundorf a.neundorf-work at gmx.net
Sun Sep 6 03:37:26 EDT 2009


On Saturday 05 September 2009, John Smith wrote:
> 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:

Thanks a lot, I added that to the bug report.

Alex


More information about the CMake mailing list