automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Macro to select c++ as default compiler for c files.


From: Václav Zeman
Subject: Re: Macro to select c++ as default compiler for c files.
Date: Mon, 3 Nov 2014 13:44:24 +0100

On 3 November 2014 11:28, Lakshmi M <address@hidden> wrote:

> Hi All,
>
> I am working with autotools and i wish to use c++ compiler by default for
> compiling my c files.
>
> USUAL behaviour  :
> ex : myexecutable_SOURCES = file.cpp      -> uses c++ compiler
>       myexecutable_SOURCES = file.c         -> uses c compiler
> (myexecutable_SOURCES is defined in my Makefile.am)
>
> Expected behaviour :
> ex : myexecutable_SOURCES = file.cpp      -> uses c++ compiler
>       myexecutable_SOURCES = file.c          -> SHOULD USE c++ compiler
> (myexecutable_SOURCES is defined in my Makefile.am)
>

​I think that Automake simply matches on the file name extension. If you
cannot rename the source files to have one of the common C++ source file
extensions (.C, .cxx, .c++, .cc) then you will have to supply compiler
specific flags, I think, like the GCC's `-x c++`​.


>
> I tried using AC_PROG_CC([c++]) and AC_LANG([C++]) in my configure.ac but
> its still using c compiler.
>
> Can anyone please let me know how to use c++ compiler as default for
> compiling my c files.
>


-- 
VZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]