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

INCLUDE_DIRECTORIES(.)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/zlib-1.2.11/inc)
AUX_SOURCE_DIRECTORY(. SRC)
SET_SOURCE_FILES_PROPERTIES(osSysinfo.c PROPERTIES COMPILE_FLAGS -w)
SET_SOURCE_FILES_PROPERTIES(osCoredump.c PROPERTIES COMPILE_FLAGS -w)

ADD_LIBRARY(os ${SRC})

IF (TD_LINUX)
  TARGET_LINK_LIBRARIES(os oslinux)

  IF (TD_LINUX_64 AND JEMALLOC_ENABLED)
    ADD_DEPENDENCIES(os jemalloc)
  ENDIF ()

  IF (TD_ARM_32 OR TD_LINUX_32)
    TARGET_LINK_LIBRARIES(os atomic)
  ENDIF ()
ELSEIF (TD_DARWIN)
  TARGET_LINK_LIBRARIES(os osdarwin)
ELSEIF (TD_WINDOWS)
  TARGET_LINK_LIBRARIES(os oswindows)
ENDIF ()
