[CMake] TARGET_LINK_LIBRARIES with full path libraries

Nils Gladitz nilsgladitz at gmail.com
Wed Sep 17 08:21:40 EDT 2014


On 09/17/2014 02:17 PM, Volker Pilipp wrote:
>
>
> On Wed, Sep 17, 2014 at 2:04 PM, Nils Gladitz <nilsgladitz at gmail.com
> <mailto:nilsgladitz at gmail.com>> wrote:
>
>     On 09/17/2014 01:50 PM, Volker Pilipp wrote:
>
>         I did so and found the following strange behaviour
>
>         link_directories(  /opt/XXX/lib ) -> no effect
>         but
>         link_directories(  /opt/ ) -> -L/opt (?!)
>
>
>     Probably the same logic as for target_link_libraries().
>     E.g. implicit link directories aren't repeated as explicit link
>     directories.
>
> But it is not an implicit link directory at least not according to the
> output of
> "/sbin/ldconfig -p" . What does cmake consider an implicit link directory?

I think a directory in which the linker looks by default (not the 
runtime loader; which is what ldconfig manages).

Run e.g.
	echo "int main() {}"|/opt/XXX/bin/g++ -xc++ - -v
And see the directories being passed to collect2 with -L.

Nils


More information about the CMake mailing list