mirror of https://github.com/google/benchmark.git
Merge pull request #115 from google/build-shared
Remove BENCHMARK_ENABLE_SHARED and prefer BUILD_SHARED_LIBS
This commit is contained in:
commit
bf58a90067
|
@ -1,7 +1,6 @@
|
||||||
cmake_minimum_required (VERSION 2.8)
|
cmake_minimum_required (VERSION 2.8)
|
||||||
project (benchmark)
|
project (benchmark)
|
||||||
|
|
||||||
option(BENCHMARK_ENABLE_SHARED "Enable building a shared library." OFF)
|
|
||||||
option(BENCHMARK_ENABLE_TESTING "Enable testing of the benchmark library." ON)
|
option(BENCHMARK_ENABLE_TESTING "Enable testing of the benchmark library." ON)
|
||||||
# Make sure we can import out CMake functions
|
# Make sure we can import out CMake functions
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
|
@ -42,7 +42,7 @@ before_build:
|
||||||
- if "%generator%"=="MinGW Makefiles" (set "PATH=%PATH:C:\Program Files (x86)\Git\bin=%")
|
- if "%generator%"=="MinGW Makefiles" (set "PATH=%PATH:C:\Program Files (x86)\Git\bin=%")
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
- cmake -G "%generator%" "-DCMAKE_BUILD_TYPE=%variant%" "-DBENCHMARK_ENABLE_SHARED=%shared%"
|
- cmake -G "%generator%" "-DCMAKE_BUILD_TYPE=%variant%" "-DBUILD_SHARED_LIBS=%shared%"
|
||||||
- cmd /c "%build%"
|
- cmd /c "%build%"
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
|
|
|
@ -17,13 +17,12 @@ else()
|
||||||
message(FATAL_ERROR "Failed to determine the source files for the regular expression backend")
|
message(FATAL_ERROR "Failed to determine the source files for the regular expression backend")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Build the benchmark library
|
add_library(benchmark ${SOURCE_FILES} ${RE_FILES})
|
||||||
if (BENCHMARK_ENABLE_SHARED)
|
|
||||||
add_library(benchmark SHARED ${SOURCE_FILES} ${RE_FILES})
|
# Link threading if building a shared library.
|
||||||
|
if (BUILD_SHARED_LIBS)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
target_link_libraries(benchmark ${CMAKE_THREAD_LIBS_INIT})
|
target_link_libraries(benchmark ${CMAKE_THREAD_LIBS_INIT})
|
||||||
else()
|
|
||||||
add_library(benchmark STATIC ${SOURCE_FILES} ${RE_FILES})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_target_properties(benchmark PROPERTIES
|
set_target_properties(benchmark PROPERTIES
|
||||||
|
|
Loading…
Reference in New Issue