forked from nclack/tictoc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
44 lines (40 loc) · 1 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
cmake_minimum_required(VERSION 2.6)
project(tictoc)
find_library(LIBRT NAMES rt)
set(TIMER_SRCS
src/tictoc.c
src/tictoc.h
)
include_directories(src)
add_library(tictoc SHARED STATIC
${TIMER_SRCS}
)
if(LIBRT)
target_link_libraries(tictoc ${LIBRT})
endif()
###############################################################################
# Testing
###############################################################################
find_path(GTEST_ROOT
CMakeLists.txt
HINTS ${ROOT_3RDPARTY_PATH} ~/src/3rdParty
PATH_SUFFIXES
gtest-1.6.0
DOC "The root directory of the gtest install prefix")
find_package(GTest)
find_package(Threads)
if(GTEST_FOUND)
enable_testing()
include_directories(${PROJECT_SOURCE_DIR})
include_directories(${GTEST_INCLUDE_DIRS})
file(GLOB TEST_SOURCES test/*.cc)
add_executable(tictoc-tests
${TEST_SOURCES}
)
target_link_libraries(tictoc-tests
${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
tictoc
)
add_test(TestTicToc tictoc-tests)
endif()