Make pkg-config optional.
Since libunwind, and therefore the CFI tests, are already optional,
might as well make pkg-config optional too.
(I'm not sure whether we actually want to support people using our
development build, but gRPC appear to be trying to do so:
https://github.com/grpc/grpc/issues/17638)
Change-Id: I16b4c53bd8a66933bc19fba29aed0d79ce2670c2
Reviewed-on: https://boringssl-review.googlesource.com/c/34124
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index abd85f5..13ee364 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,12 +40,16 @@
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- find_package(PkgConfig REQUIRED)
- pkg_check_modules(LIBUNWIND libunwind-generic)
- if(LIBUNWIND_FOUND)
- add_definitions(-DBORINGSSL_HAVE_LIBUNWIND)
+ find_package(PkgConfig QUIET)
+ if (PkgConfig_FOUND)
+ pkg_check_modules(LIBUNWIND libunwind-generic)
+ if(LIBUNWIND_FOUND)
+ add_definitions(-DBORINGSSL_HAVE_LIBUNWIND)
+ else()
+ message("libunwind not found. Disabling unwind tests.")
+ endif()
else()
- message("libunwind not found. Disabling unwind tests.")
+ message("pkgconfig not found. Disabling unwind tests.")
endif()
endif()