mirror of
https://github.com/google/benchmark.git
synced 2024-11-29 18:34:47 +00:00
Configure 'benchmark' cmake target so that when other targets depend on it,
they get the appropriate include directories and link libraries automatically.
This commit is contained in:
parent
42d2b8d11a
commit
a6ad799a4d
|
@ -18,10 +18,12 @@ else()
|
|||
endif()
|
||||
|
||||
add_library(benchmark ${SOURCE_FILES} ${RE_FILES})
|
||||
|
||||
# Link threading if building a shared library.
|
||||
if (BUILD_SHARED_LIBS)
|
||||
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()
|
||||
|
||||
|
@ -36,6 +38,8 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
|||
target_link_libraries(benchmark Shlwapi)
|
||||
endif()
|
||||
|
||||
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 a new issue