Require cmake 2.8.12 in order to support target_include_directories, and

simplify thread linking logic.
This commit is contained in:
Geoff Romer 2015-04-02 14:35:59 -07:00 committed by Dominic Hamon
parent a6ad799a4d
commit 89a1edae15
2 changed files with 3 additions and 8 deletions

View File

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 2.8.12)
project (benchmark)
option(BENCHMARK_ENABLE_TESTING "Enable testing of the benchmark library." ON)

View File

@ -18,14 +18,9 @@ else()
endif()
add_library(benchmark ${SOURCE_FILES} ${RE_FILES})
find_package(Threads REQUIRED)
# Link threading if building a shared library, otherwise let client do it.
if (BUILD_SHARED_LIBS)
target_link_libraries(benchmark PRIVATE ${CMAKE_THREAD_LIBS_INIT})
else()
target_link_libraries(benchmark ${CMAKE_THREAD_LIBS_INIT})
endif()
find_package(Threads REQUIRED)
target_link_libraries(benchmark ${CMAKE_THREAD_LIBS_INIT})
set_target_properties(benchmark PROPERTIES
OUTPUT_NAME "benchmark"