CMakeLists.txt 2.1 KB
Newer Older
1
CMAKE_MINIMUM_REQUIRED(VERSION 2.8...3.20)
H
hjxilinx 已提交
2 3 4
PROJECT(TDengine)

FIND_PATH(HEADER_GTEST_INCLUDE_DIR gtest.h /usr/include/gtest /usr/local/include/gtest)
5 6
FIND_LIBRARY(LIB_GTEST_STATIC_DIR libgtest.a /usr/lib/ /usr/local/lib /usr/lib64)
FIND_LIBRARY(LIB_GTEST_SHARED_DIR libgtest.so /usr/lib/ /usr/local/lib /usr/lib64)
H
hjxilinx 已提交
7

8
IF (HEADER_GTEST_INCLUDE_DIR AND (LIB_GTEST_STATIC_DIR OR LIB_GTEST_SHARED_DIR))
H
hjxilinx 已提交
9 10 11 12
    MESSAGE(STATUS "gTest library found, build unit test")

    INCLUDE_DIRECTORIES(${HEADER_GTEST_INCLUDE_DIR})
    AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)
13

H
[NONE]  
Hui Li 已提交
14
    LIST(REMOVE_ITEM SOURCE_LIST ${CMAKE_CURRENT_SOURCE_DIR}/trefTest.c)
H
Haojun Liao 已提交
15
    ADD_EXECUTABLE(utilTest ${SOURCE_LIST})
L
fix tq  
Liu Jicong 已提交
16
    TARGET_LINK_LIBRARIES(utilTest util common os gtest pthread)
H
[NONE]  
Hui Li 已提交
17

D
dapan1121 已提交
18 19 20
    LIST(REMOVE_ITEM SOURCE_LIST ${CMAKE_CURRENT_SOURCE_DIR}/cacheTest.cpp)
    LIST(APPEND SOURCE_LIST ${CMAKE_CURRENT_SOURCE_DIR}/hashTest.cpp)
    ADD_EXECUTABLE(hashTest ${SOURCE_LIST})
L
fix tq  
Liu Jicong 已提交
21
    TARGET_LINK_LIBRARIES(hashTest util common os gtest pthread)
D
dapan1121 已提交
22
    
H
[NONE]  
Hui Li 已提交
23 24
    LIST(APPEND BIN_SRC ${CMAKE_CURRENT_SOURCE_DIR}/trefTest.c)
    ADD_EXECUTABLE(trefTest ${BIN_SRC})
D
dapan1121 已提交
25
    TARGET_LINK_LIBRARIES(trefTest common util)
H
[NONE]  
Hui Li 已提交
26

S
Shuduo Sang 已提交
27
ENDIF()
H
Haojun Liao 已提交
28

H
[NONE]  
Hui Li 已提交
29 30
#IF (TD_LINUX)
#    ADD_EXECUTABLE(trefTest ./trefTest.c)
D
dapan1121 已提交
31
#    TARGET_LINK_LIBRARIES(trefTest util common)
H
[NONE]  
Hui Li 已提交
32
#ENDIF ()
H
Haojun Liao 已提交
33

wafwerar's avatar
wafwerar 已提交
34
INCLUDE_DIRECTORIES(${TD_SOURCE_DIR}/src/util/inc)
H
Haojun Liao 已提交
35

H
Hongze Cheng 已提交
36 37 38 39 40 41 42
# # freelistTest
# add_executable(freelistTest "")
# target_sources(freelistTest
#     PRIVATE
#     "freelistTest.cpp"
# )
# target_link_libraries(freelistTest os util gtest gtest_main)
H
more  
Hongze Cheng 已提交
43

H
Hongze Cheng 已提交
44 45 46
# # encodeTest
# add_executable(encodeTest "encodeTest.cpp")
# target_link_libraries(encodeTest os util gtest gtest_main)
H
Hongze Cheng 已提交
47

S
Shengliang Guan 已提交
48
# queueTest
S
Shengliang Guan 已提交
49 50
add_executable(procTest "procTest.cpp")
target_link_libraries(procTest os util transport sut gtest_main)   
S
Shengliang Guan 已提交
51
add_test(
S
Shengliang Guan 已提交
52 53
    NAME procTest
    COMMAND procTest
S
Shengliang Guan 已提交
54 55 56 57 58 59 60 61
)

# cfgTest
add_executable(cfgTest "cfgTest.cpp")
target_link_libraries(cfgTest os util gtest_main)   
add_test(
    NAME cfgTest
    COMMAND cfgTest
R
root 已提交
62 63 64 65 66 67 68 69
)

# bloomFilterTest
add_executable(bloomFilterTest "bloomFilterTest.cpp")
target_link_libraries(bloomFilterTest os util gtest_main)   
add_test(
    NAME bloomFilterTest
    COMMAND bloomFilterTest
S
Shengliang Guan 已提交
70
)