forked from nguliu/mySTL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
38 lines (27 loc) · 949 Bytes
/
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
cmake_minimum_required(VERSION 3.10.2) #如果cmake版本过低请自行更改
project(mySTL CXX)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
set(CXX_FLAGS
-g
# -Wall
# -Werror
-std=c++11
-D_PTHREADS
-Wno-unused-parameter
)
set(CMAKE_CXX_COMPILER "g++")
set(CMAKE_CXX_FLAGS_DEBUG "-O0")
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
#设置可执行文件输出在工程目录上两级的bin目录下
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/../../bin)
#设置库文件输出在工程目录的lib目录
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
#注意要包含源文件目录,否则程序找不到库文件
include_directories(${PROJECT_SOURCE_DIR})
string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CXX_FLAGS}")
string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
message(STATUS "CXX_FLAGS = " ${CMAKE_CXX_FLAGS} " " ${CMAKE_CXX_FLAGS_${BUILD_TYPE}})
add_subdirectory(mySTL)
add_subdirectory(tests)