Skip to content

Commit

Permalink
cmake: Link Google Benchmark library against pthread
Browse files Browse the repository at this point in the history
Fixes: #264
  • Loading branch information
gjasny committed Apr 27, 2019
1 parent d5d814d commit 21e6055
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmake/FindGoogleBenchmark.cmake
Expand Up @@ -2,12 +2,15 @@ find_library(GoogleBenchmark_LIBRARY NAMES benchmark)
find_path(GoogleBenchmark_INCLUDE_DIR benchmark/benchmark.h)
mark_as_advanced(GoogleBenchmark_LIBRARY GoogleBenchmark_INCLUDE_DIR)

find_package(Threads QUIET)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GoogleBenchmark
FOUND_VAR GoogleBenchmark_FOUND
REQUIRED_VARS
GoogleBenchmark_LIBRARY
GoogleBenchmark_INCLUDE_DIR
Threads_FOUND
)

if(GoogleBenchmark_FOUND)
Expand All @@ -18,6 +21,7 @@ if(GoogleBenchmark_FOUND)
add_library(Google::Benchmark UNKNOWN IMPORTED)
set_target_properties(Google::Benchmark PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${GoogleBenchmark_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "Threads::Threads"
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${GoogleBenchmark_LIBRARY}"
)
Expand Down

0 comments on commit 21e6055

Please sign in to comment.