Skip to content

Commit

Permalink
Add -lkstat to the .pc for Solaris (google#1801)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ccotter authored Jul 3, 2024
1 parent c214639 commit 71f4218
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmake/benchmark.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -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}
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 71f4218

Please sign in to comment.