env.inc 2.2 KB
Newer Older
1
CMAKE_MINIMUM_REQUIRED(VERSION 2.8...3.20)
S
[TD-58]  
slguan 已提交
2 3
PROJECT(TDengine)

S
slguan 已提交
4 5 6 7 8 9 10 11 12 13 14 15 16
SET(CMAKE_C_STANDARD 11)
SET(CMAKE_VERBOSE_MAKEFILE ON)

#set output directory
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/build/lib)
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/build/bin)
SET(TD_TESTS_OUTPUT_DIR ${PROJECT_BINARY_DIR}/test)

MESSAGE(STATUS "Project source directory: " ${PROJECT_SOURCE_DIR})
MESSAGE(STATUS "Project binary files output path: " ${PROJECT_BINARY_DIR})
MESSAGE(STATUS "Project executable files output path: " ${EXECUTABLE_OUTPUT_PATH})
MESSAGE(STATUS "Project library files output path: " ${LIBRARY_OUTPUT_PATH})

17 18 19 20 21 22 23
IF (TD_BUILD_JDBC)
    FIND_PROGRAM(TD_MVN_INSTALLED mvn)
    IF (TD_MVN_INSTALLED)
        MESSAGE(STATUS "MVN is installed and JDBC will be compiled")
    ELSE ()
        MESSAGE(STATUS "MVN is not installed and JDBC is not compiled")
    ENDIF ()
S
[TD-58]  
slguan 已提交
24 25 26 27 28 29 30 31 32 33 34 35 36
ENDIF ()

#
# If need to set debug options
#   1.Generate debug version:
#     mkdir debug; cd debug;
#     cmake -DCMAKE_BUILD_TYPE=Debug ..
#   2.Generate release version:
#     mkdir release; cd release;
#     cmake -DCMAKE_BUILD_TYPE=Release ..
#

# Set compiler options
37 38 39 40 41 42
IF (TD_LINUX)
  SET(COMMON_C_FLAGS "${COMMON_FLAGS} -std=gnu99")
ELSE ()
  SET(COMMON_C_FLAGS "${COMMON_FLAGS} ")
ENDIF ()

43 44
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${COMMON_C_FLAGS} ${DEBUG_FLAGS}")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${COMMON_C_FLAGS} ${RELEASE_FLAGS}")
S
[TD-58]  
slguan 已提交
45 46

# Set c++ compiler options
47 48 49 50 51 52
IF (TD_WINDOWS)
  SET(COMMON_CXX_FLAGS "${COMMON_FLAGS} -std=c++11")
ELSE ()
  SET(COMMON_CXX_FLAGS "${COMMON_FLAGS} -std=c++11 -Wno-unused-function")
ENDIF ()

53 54
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COMMON_CXX_FLAGS} ${DEBUG_FLAGS}")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${COMMON_CXX_FLAGS} ${RELEASE_FLAGS}")
S
[TD-58]  
slguan 已提交
55 56

IF (${CMAKE_BUILD_TYPE} MATCHES "Debug")
S
Shengliang Guan 已提交
57
  SET(CMAKE_BUILD_TYPE "Debug")
S
[TD-58]  
slguan 已提交
58 59
  MESSAGE(STATUS "Build Debug Version")
ELSEIF (${CMAKE_BUILD_TYPE} MATCHES "Release")
S
Shengliang Guan 已提交
60
  SET(CMAKE_BUILD_TYPE "Release")
S
[TD-58]  
slguan 已提交
61 62
  MESSAGE(STATUS "Build Release Version")
ELSE ()
S
Shengliang Guan 已提交
63
  IF (TD_WINDOWS)
S
[TD-58]  
slguan 已提交
64 65 66 67 68 69
    SET(CMAKE_BUILD_TYPE "Release")
    MESSAGE(STATUS "Build Release Version in Windows as default")
  ELSE ()
    SET(CMAKE_BUILD_TYPE "Debug")
    MESSAGE(STATUS "Build Debug Version as default")
  ENDIF()
70
ENDIF ()