automake
[Top][All Lists]
Advanced

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

Re: adding conditionally a c++ file implies static linking with g++


From: Vincent Torri
Subject: Re: adding conditionally a c++ file implies static linking with g++
Date: Sat, 20 Nov 2010 00:55:27 +0100 (CET)


Hey

If the question at the bottom is related to libtool and not automake, tell me and I'll forward the mail to the libtool ML.

* Vincent Torri wrote on Fri, Nov 05, 2010 at 04:56:55PM CET:
foo_SOURCES = bar1.c

if MY_COND
foo_SOURCES += bar2.cpp
else
foo_SOURCES += bar2.c
endif

One told me on that ML that it is normal that automake uses g++ for
linking, even if MY_COND is not verified. One possible way to work around
that is redefining rules of linking, according to the value of MY_COND.
Something like (maybe not 100% correct) :

if MY_COND
foo_la-bar2.lo: bar2.cpp
        $(LTCXXCOMPILE) blah blah blah
else
foo_la-bar2.lo: bar2.c
        $(LTCOMPILE) blah blah blah
endif

Is there something more elegant than doing that ?

Not really.  I agree that it's kind of ugly, but what's even more,
there are uses relying on something like this to happen: it was
actually recommended to do e.g.,

if COND_FALSE
nodist_foo_SOURCES += force-c++-linker.cc
endif

so I'm afraid you might have to live with a workaround.
You can set foo_LINK for linking.

Now, i've remarked a side effect. What I'm building is a shared lib that is only opened by dlopen. So I pass --tag=disable-static to pdf_la_LIBTOOLFLAGS. When using foo_LINK, the static lib is build, hence installed. Is there a way to forbid the build of the static lib.

Of course, I can always delete it during install with the install-data-hook rule, but i would like to not build it.

thank you

Vincent Torri



reply via email to

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