mirror of
https://github.com/google/benchmark.git
synced 2025-03-05 23:00:10 +08:00
Merge branch 'geoffromer-cmake-patch'
This commit is contained in:
commit
2b954213f9
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
cmake_minimum_required (VERSION 2.8.11)
|
||||
project (benchmark)
|
||||
|
||||
option(BENCHMARK_ENABLE_TESTING "Enable testing of the benchmark library." ON)
|
||||
@ -55,6 +55,9 @@ cxx_feature_check(GNU_POSIX_REGEX)
|
||||
cxx_feature_check(POSIX_REGEX)
|
||||
cxx_feature_check(STEADY_CLOCK)
|
||||
|
||||
# Ensure we have pthreads
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
# Set up directories
|
||||
include_directories(${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
|
@ -19,23 +19,24 @@ endif()
|
||||
|
||||
add_library(benchmark ${SOURCE_FILES} ${RE_FILES})
|
||||
|
||||
# Link threading if building a shared library.
|
||||
if (BUILD_SHARED_LIBS)
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(benchmark ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
set_target_properties(benchmark PROPERTIES
|
||||
OUTPUT_NAME "benchmark"
|
||||
VERSION ${GENERIC_LIB_VERSION}
|
||||
SOVERSION ${GENERIC_LIB_SOVERSION}
|
||||
)
|
||||
)
|
||||
|
||||
# Link threads.
|
||||
target_link_libraries(benchmark ${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
# We need extra libraries on Windows
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||
target_link_libraries(benchmark Shlwapi)
|
||||
endif()
|
||||
|
||||
# Expose public API
|
||||
target_include_directories(benchmark PUBLIC ${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
# Install target (will install the library to specified CMAKE_INSTALL_PREFIX variable)
|
||||
install(
|
||||
TARGETS benchmark
|
||||
|
Loading…
Reference in New Issue
Block a user