[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Specifying Flag Order?
From: |
Gavin Smith |
Subject: |
Re: Specifying Flag Order? |
Date: |
Thu, 23 May 2013 11:02:27 +0100 |
On Thu, May 23, 2013 at 12:46 AM, Jordan H. <address@hidden> wrote:
> I'm using mysql in a program. Here is a snipped of my Makefile.am:
>
> project_LDADD += -lboost_thread
> project_LDADD += -lboost_regex
> project_LDADD += -lboost_system
>
> AM_LDFLAGS = -L/usr/local/lib
> AM_LDFLAGS += `mysql_config --libs_r`
> AM_LDFLAGS += `mysql_config --include`
> AM_LDFLAGS += -std=c++0x
> AM_LDFLAGS += `mysql_config --cflags`
>
> When I compile the program, automake generated:
>
> g++ -g -O2 -L/usr/local/lib `mysql_config --libs_r` `mysql_config
> --include` -std=c++0x
> `mysql_config --cflags` -o /[ ... a bunch of .o files ... ]/
> -lboost_thread -lboost_regex
> -lboost_system
>
> As expected, since g++ needs linker flags at the end I get a bunch of
> compile errors saying the `mysql_*` functions don't exist. How do I
> specify for the linker flags to go at the end? I tried to put them in
> the project_LDADD macro but automake complained:
>
> Makefile.am:13: linker flags such as `--libs_r`' belong in
> `project_LDFLAGS
>
> Which got me back to square one. I must be doing something wrong. Any
> ideas? This has been bugging me for days. Thanks in advance.
You haven't said whether you've tried using project_LDFLAGS (you've
used AM_LDFLAGS and project_LDADD).
It might be easier if you wrote out the command you would like to be generated