CMakeLists.txt 863 字节
Newer Older
H
hzcheng 已提交
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
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)

PROJECT(TDengine)

AUX_SOURCE_DIRECTORY(./src SRC)
INCLUDE_DIRECTORIES(${PRJ_HEADER_PATH} ./inc)

ADD_LIBRARY(tutil ${SRC})
TARGET_LINK_LIBRARIES(tutil m pthread)

FIND_PATH(ICONV_INCLUDE_EXIST iconv.h /usr/include/ /usr/local/include/)
IF (ICONV_INCLUDE_EXIST)
  ADD_DEFINITIONS(-DUSE_LIBICONV)

  FIND_PATH(ICONV_LIBRARY_A_EXIST libiconv.a /usr/lib/ /usr/local/lib/ /lib64)
  FIND_PATH(ICONV_LIBRARY_SO_EXIST libiconv.so /usr/lib/ /usr/local/lib/ /lib64)
  IF (ICONV_LIBRARY_A_EXIST OR ICONV_LIBRARY_SO_EXIST)
    MESSAGE(STATUS "Use the installed libiconv library")
    TARGET_LINK_LIBRARIES(tutil iconv)
  ELSE ()
    # libiconv library is already included in GLIBC,
    MESSAGE(STATUS "Use the iconv functions in GLIBC")
  ENDIF ()
ELSE ()
  MESSAGE(STATUS "Failed to find iconv, use default encoding method")
ENDIF ()