This work fine.

```
add_executable( my_exe file.c )
target_link_libraries( my_exe /lib64/libldap_r-2.4.so.2 )

```

But why doesn't this work?

```
link_directories( /lib64 )
add_executable( my_exe file.c )
target_link_libraries(my_exe ldap_r-2.4 )

```

Error message:

```
/usr/bin/ld: cannot find -lldap_r-2.4

```

Directory /lib64 contains the following files:

```
libldap_r-2.4.so.2 -> libldap_r-2.4.so.2.5.6
libldap_r-2.4.so.2.5.6

```