CMAKE_MINIMUM_REQUIRED(VERSION 3.0...3.20)
PROJECT(TDengine)

INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/tsdb/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/client/inc)
INCLUDE_DIRECTORIES(inc)

AUX_SOURCE_DIRECTORY(src SRC)
ADD_LIBRARY(query ${SRC})
SET_SOURCE_FILES_PROPERTIES(src/sql.c PROPERTIES COMPILE_FLAGS -w)
TARGET_LINK_LIBRARIES(query tsdb tutil ${LINK_LUA})

IF (TD_LINUX)
  IF (TD_BUILD_LUA)
      TARGET_LINK_LIBRARIES(query m rt ${LINK_LUA})
  ELSE ()
    TARGET_LINK_LIBRARIES(query m rt)
  ENDIF ()
  ADD_SUBDIRECTORY(tests)
ENDIF ()

IF (TD_DARWIN)
  IF (TD_BUILD_LUA)
      TARGET_LINK_LIBRARIES(query m ${LINK_LUA})
  ELSE ()
    TARGET_LINK_LIBRARIES(query m)
  ENDIF ()
  ADD_SUBDIRECTORY(tests)
ENDIF ()
