Add -lkstat to the .pc for Solaris (#1801)

* Add -lkstat to the .pc for Solaris

This fixes linking for projects that rely on pkg-config to generate the
link line on Solaris.

Test plan: Built the project locally on Solaris and verified -kstat
appears in the .pc file

```
$ cat lib/pkgconfig/benchmark.pc  | grep Libs.private
Libs.private: -lpthread -lkstat
```

* Use BENCHMARK_PRIVATE_LINK_LIBRARIES
This commit is contained in:
Chris Cotter 2024-07-03 14:16:43 -04:00 committed by GitHub
parent c2146397ac
commit 71f4218c1a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -8,5 +8,5 @@ Description: Google microbenchmark framework
Version: @VERSION@
Libs: -L${libdir} -lbenchmark
Libs.private: -lpthread
Libs.private: -lpthread @BENCHMARK_PRIVATE_LINK_LIBRARIES@
Cflags: -I${includedir}

View File

@ -64,6 +64,7 @@ endif()
# We need extra libraries on Solaris
if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
target_link_libraries(benchmark PRIVATE kstat)
set(BENCHMARK_PRIVATE_LINK_LIBRARIES -lkstat)
endif()
if (NOT BUILD_SHARED_LIBS)