[CMake] Problem with LINK_DIRECTORIES
Michael Wild
themiwi at gmail.com
Mon Nov 14 07:42:09 EST 2011
On 11/14/2011 11:46 AM, Arunmozhi wrote:
> Hi,
>
> For a static library target, I used TARGET_LINK_LIBRARIES and
> LINK_DIRECTORIES to link with a third party library. As we can see that
> in cmake, this linking information is propagated and used only in an
> executable/shared library target which depends on the former static
> library. But the issue is that only the TARGET_LINK_LIBRARIES is
> propagated and not the LINK_DIRECTORIES. This fails the linking of the
> executable/shared library target because it could not find the third
> party library.
>
> I found this problem when generating for visual studio 2005. The problem
> might be there in other platforms also.
>
> I feel that this behavior is an issue. Or am I missing something? Please
> let me know.
>
> Regards,
> Arun
>
Hi Arun
Consider LINK_DIRECTORIES to be obsolete and to be avoided at all cost.
Just pass the full path to the static library directly to
TARGET_LINK_LIBRARIES. This is much more robust and will avoid these
weird effects you are seeing.
HTH
Michael
More information about the CMake
mailing list