mirror of
https://github.com/google/benchmark.git
synced 2025-02-26 11:20:28 +08:00
Setup targets from each directory, rather than the top-level.
This commit is contained in:
parent
9b5ece6ece
commit
e38fde6450
@ -30,19 +30,6 @@ include_directories(${PROJECT_SOURCE_DIR}/include)
|
|||||||
include_directories(${PROJECT_SOURCE_DIR}/src)
|
include_directories(${PROJECT_SOURCE_DIR}/src)
|
||||||
|
|
||||||
# Build the targets
|
# Build the targets
|
||||||
FILE(GLOB SOURCE_FILES "src/*.cc")
|
enable_testing()
|
||||||
add_library(benchmark STATIC ${SOURCE_FILES})
|
add_subdirectory(src)
|
||||||
|
add_subdirectory(test)
|
||||||
add_executable(benchmark_test test/benchmark_test.cc)
|
|
||||||
target_link_libraries(benchmark_test benchmark ${CMAKE_THREAD_LIBS_INIT})
|
|
||||||
|
|
||||||
# Install target (will install the library to specified CMAKE_INSTALL_PREFIX variable)
|
|
||||||
INSTALL(
|
|
||||||
TARGETS benchmark
|
|
||||||
ARCHIVE DESTINATION lib
|
|
||||||
LIBRARY DESTINATION lib
|
|
||||||
COMPONENT library)
|
|
||||||
INSTALL(
|
|
||||||
DIRECTORY "${PROJECT_SOURCE_DIR}/include/benchmark"
|
|
||||||
DESTINATION include
|
|
||||||
FILES_MATCHING PATTERN "*.*h")
|
|
||||||
|
14
src/CMakeLists.txt
Normal file
14
src/CMakeLists.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
set(SOURCE_FILES "benchmark.cc" "colorprint.cc" "commandlineflags.cc" "sleep.cc" "sysinfo.cc" "walltime.cc")
|
||||||
|
|
||||||
|
add_library(benchmark STATIC ${SOURCE_FILES})
|
||||||
|
|
||||||
|
# Install target (will install the library to specified CMAKE_INSTALL_PREFIX variable)
|
||||||
|
install(
|
||||||
|
TARGETS benchmark
|
||||||
|
ARCHIVE DESTINATION lib
|
||||||
|
LIBRARY DESTINATION lib
|
||||||
|
COMPONENT library)
|
||||||
|
install(
|
||||||
|
DIRECTORY "${PROJECT_SOURCE_DIR}/include/benchmark"
|
||||||
|
DESTINATION include
|
||||||
|
FILES_MATCHING PATTERN "*.*h")
|
3
test/CMakeLists.txt
Normal file
3
test/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Demonstration executable
|
||||||
|
add_executable(benchmark_test benchmark_test.cc)
|
||||||
|
target_link_libraries(benchmark_test benchmark ${CMAKE_THREAD_LIBS_INIT})
|
Loading…
Reference in New Issue
Block a user