-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
46 lines (33 loc) · 1.31 KB
/
CMakeLists.txt
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
cmake_minimum_required(VERSION 3.0)
PROJECT(MessageCache)
IF (EXISTS CMAKE_BUILD_TYPE)
IF (CMAKE_BUILD_TYPE MATCHES "Release")
SET(CMAKE_BUILD_POSTFIX ${CMAKE_BUILD_TYPE})
ELSEIF(CMAKE_BUILD_TYPE MATCHES "Debug")
SET(CMAKE_BUILD_POSTFIX ${CMAKE_BUILD_TYPE})
ELSE()
MESSAGE(FATAL_ERROR "The CMAKE_BUILD_TYPE only supports Release or Debug")
ENDIF()
ELSE()
SET(CMAKE_BUILD_TYPE "Release")
SET(CMAKE_BUILD_POSTFIX "Release")
ENDIF()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Debug)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Debug)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
# IF (ENABLE_UT)
# add_subdirectory(unittest)
# ENDIF ()
AUX_SOURCE_DIRECTORY(./ DIR_SRCS)
ADD_EXECUTABLE(${PROJECT_NAME} ${DIR_SRCS})
find_package(Boost 1.72)
find_library(LIBTCMALLOC_PATH tcmalloc_minimal)
IF(NOT LIBTCMALLOC_PATH)
MESSAGE(FATAL_ERROR "tcmalloc not found")
ENDIF(NOT LIBTCMALLOC_PATH)
MESSAGE(STATUS ${LIBTCMALLOC_PATH} " found")
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIBTCMALLOC_PATH})
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread")