File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -62,13 +62,11 @@ endif(HAVE_LIB_RT)
6262# We need extra libraries on Windows
6363if (${CMAKE_SYSTEM_NAME} MATCHES "Windows" )
6464 target_link_libraries (benchmark PRIVATE shlwapi)
65- set (BENCHMARK_PRIVATE_LINK_LIBRARIES -lShlwapi)
6665endif ()
6766
6867# We need extra libraries on Solaris
6968if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS" )
7069 target_link_libraries (benchmark PRIVATE kstat)
71- set (BENCHMARK_PRIVATE_LINK_LIBRARIES -lkstat)
7270endif ()
7371
7472if (NOT BUILD_SHARED_LIBS )
@@ -110,6 +108,20 @@ write_basic_package_version_file(
110108 "${version_config} " VERSION ${GENERIC_LIB_VERSION} COMPATIBILITY SameMajorVersion
111109)
112110
111+ # Derive private link libraries from target
112+ if (NOT BUILD_SHARED_LIBS )
113+ get_target_property (LINK_LIBS benchmark LINK_LIBRARIES )
114+ if (LINK_LIBS)
115+ set (BENCHMARK_PRIVATE_LINK_LIBRARIES "" )
116+ foreach (LIB IN LISTS LINK_LIBS)
117+ if (NOT TARGET "${LIB} " AND LIB MATCHES "^[a-zA-Z0-9_.-]+$" )
118+ list (APPEND BENCHMARK_PRIVATE_LINK_LIBRARIES "-l${LIB} " )
119+ endif ()
120+ endforeach ()
121+ string (JOIN " " BENCHMARK_PRIVATE_LINK_LIBRARIES ${BENCHMARK_PRIVATE_LINK_LIBRARIES} )
122+ endif ()
123+ endif ()
124+
113125configure_file ("${PROJECT_SOURCE_DIR} /cmake/benchmark.pc.in" "${pkg_config} " @ONLY)
114126configure_file ("${PROJECT_SOURCE_DIR} /cmake/benchmark_main.pc.in" "${pkg_config_main} " @ONLY)
115127
You can’t perform that action at this time.
0 commit comments