Commit a6ad799a by Geoff Romer Committed by Dominic Hamon

Configure 'benchmark' cmake target so that when other targets depend on it,

they get the appropriate include directories and link libraries automatically.
parent 42d2b8d1
...@@ -18,10 +18,12 @@ else() ...@@ -18,10 +18,12 @@ else()
endif() endif()
add_library(benchmark ${SOURCE_FILES} ${RE_FILES}) add_library(benchmark ${SOURCE_FILES} ${RE_FILES})
find_package(Threads REQUIRED)
# Link threading if building a shared library. # Link threading if building a shared library, otherwise let client do it.
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
find_package(Threads REQUIRED) target_link_libraries(benchmark PRIVATE ${CMAKE_THREAD_LIBS_INIT})
else()
target_link_libraries(benchmark ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries(benchmark ${CMAKE_THREAD_LIBS_INIT})
endif() endif()
...@@ -36,6 +38,8 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") ...@@ -36,6 +38,8 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
target_link_libraries(benchmark Shlwapi) target_link_libraries(benchmark Shlwapi)
endif() endif()
target_include_directories(benchmark PUBLIC ${PROJECT_SOURCE_DIR}/include)
# Install target (will install the library to specified CMAKE_INSTALL_PREFIX variable) # Install target (will install the library to specified CMAKE_INSTALL_PREFIX variable)
install( install(
TARGETS benchmark TARGETS benchmark
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment