Commit 25b306ef authored by Ivan Shapovalov's avatar Ivan Shapovalov

cmake: drop NO_DEFAULT_PATHS when searching libraries

It looks like pkg-config silently drops -I and -L flags pointing to
default directories:

```
$ cat /usr/lib/pkgconfig/capnp.pc
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: Cap'n Proto
Description: Insanely fast serialization system
Version: 0.7-dev
Libs: -L${libdir} -lcapnp -pthread  -lpthread
Libs.private:  -lpthread
Requires: kj = 0.7-dev
Cflags: -I${includedir} -pthread

$ pkg-config --libs capnp
-lcapnp -pthread -lpthread -lkj -pthread -lpthread
```

Ideally, however, we should use FindPkgConfig.cmake's own facilities
to generate IMPORTED targets from pkg-config files.
parent 3d97775b
......@@ -86,7 +86,6 @@ function(_capnp_import_pkg_config_target target)
find_library(CapnProto_${target}_IMPORTED_LOCATION
NAMES ${target_name_shared} ${target_name_static} # prefer libfoo-version.so over libfoo.a
PATHS ${${target}_LIBRARY_DIRS}
NO_DEFAULT_PATH
)
if(NOT CapnProto_${target}_IMPORTED_LOCATION)
# Not an error if the library doesn't exist -- we may have found a lite mode installation.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment