Comment 3 for bug 892793

Revision history for this message
Anders Logg (logg) wrote : Re: [Bug 892793] Re: dolfin.pc does not respect library order

On Sun, Nov 20, 2011 at 09:48:10PM -0000, Garth Wells wrote:
> On 20 November 2011 21:38, Anders Logg <email address hidden> wrote:
> > Which order is that?
> >
>
> The order that CMake uses when building.
>
> > Is the problem the reversal of the order of libs when PKG_LINKFLAGS is
> > build in dolfin/CMakeLists.txt?
> >
>
> Probably. We could use the trick that I added for Trilinos - reverse
> the order of the set.

Isn't it just a matter of changing the line

  set(PKG_LINKFLAGS "${_linkflags} ${PKG_LINKFLAGS}")

to

  set(PKG_LINKFLAGS "${PKG_LINKFLAGS} ${_linkflags} ${PKG_LINKFLAGS}")

?

--
Anders

> Garth
>
> >
> > # Convert libraries to -L<libdir> -l<lib> form
> > foreach(_lib ${DOLFIN_TARGET_LINK_LIBRARIES})
> >  string(REGEX REPLACE "(.?:?/[^ ]*)/lib([^ ]*)\\.(a|so|dylib|dll)" "-L\\1 -l\\2"
> >    _linkflags
> >    "${_lib}"
> >    )
> >
> >  # Only add libraries that matches the form -L<libdir> -l<lib>
> >  if ("${_linkflags}" MATCHES "-L.+ -l.+")
> >    set(PKG_LINKFLAGS "${_linkflags} ${PKG_LINKFLAGS}")
> >   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >  endif()
> > endforeach()
> >
> >
> > Title:
> >  dolfin.pc does not respect library order
> >
> > To manage notifications about this bug go to:
> > https://bugs.launchpad.net/dolfin/+bug/892793/+subscriptions
> >
>