forked from sunflover/LoggerDemo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
67 lines (52 loc) · 1.6 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# CMakeList.txt: CMakeProject1 的 CMake 项目,在此处包括源代码并定义
# 项目特定的逻辑。
#
cmake_minimum_required (VERSION 3.8)
project ("commonlog"
DESCRIPTION "log library"
VERSION 0.9.1
)
set(CMAKE_CXX_STANDARD 11)
#可执行程序生成目录
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/Lib)
#lib生成目录
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/Lib)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/Lib)
set(CMAKE_AUTOMOC ON)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
set(CMAKE_VERBOSE_MAKEFILEON ON)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CURRENT_SYSTEM Linux)
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(CURRENT_SYSTEM Windows)
ENDIF()
#静态库
add_library (${PROJECT_NAME}
logsrc/logger.cpp
logsrc/RC4.cpp
)
add_executable(${PROJECT_NAME}_test
main.cpp
)
target_include_directories( ${PROJECT_NAME}_test
PRIVATE
${PROJECT_SOURCE_DIR}
)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
target_link_libraries( ${PROJECT_NAME}_test
PRIVATE
${PROJECT_SOURCE_DIR}/build/Lib/lib${PROJECT_NAME}.a
)
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Windows")
target_link_libraries( ${PROJECT_NAME}_test
PRIVATE
${PROJECT_SOURCE_DIR}/build/Lib/${PROJECT_NAME}.lib
)
ENDIF()
#动态库
# add_library (${PROJECT_NAME} SHARED
# logger.cpp
# RC4.cpp
# )