CMakeLists.txt 876 字节
Newer Older
1
CMAKE_MINIMUM_REQUIRED(VERSION 3.0...3.20)
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)
7

8
IF (HEADER_GTEST_INCLUDE_DIR AND (LIB_GTEST_STATIC_DIR OR LIB_GTEST_SHARED_DIR))
9 10
    MESSAGE(STATUS "gTest library found, build unit test")

11 12 13 14
    # GoogleTest requires at least C++11
    SET(CMAKE_CXX_STANDARD 11)

    INCLUDE_DIRECTORIES(/usr/include /usr/local/include)
15 16 17
    IF (NOT LIB_GTEST_STATIC_DIR)
        LINK_DIRECTORIES(/usr/lib /usr/local/lib)
    ENDIF()
18

19 20 21
    AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)

    ADD_EXECUTABLE(osTest ${SOURCE_LIST})
22
    TARGET_LINK_LIBRARIES(osTest taos os cJson tutil common gtest pthread)
23
ENDIF()