-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
102 lines (83 loc) · 3.78 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# MIT License
# Copyright (c) 2021 Colin
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.8)
set(This uhpsqld)
project(${This} C CXX)
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
enable_testing()
get_directory_property(ParentDirectory PARENT_DIRECTORY)
if(ParentDirectory STREQUAL "")
# Define option for linking with runtime statically
if(MSVC)
option(RUNTIME_STATIC_LINKAGE "Link with runtime library statically" OFF)
endif(MSVC)
if(MSVC AND RUNTIME_STATIC_LINKAGE)
foreach(flag
CMAKE_C_FLAGS
CMAKE_CXX_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_CXX_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_RELWITHDEBINFO
)
if(${flag} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MI" ${flag} "${${flag}}")
endif(${flag} MATCHES "/MD")
endforeach(flag)
endif(MSVC AND RUNTIME_STATIC_LINKAGE)
# Keep Google Test's linkage of the runtime in sync our own
if(RUNTIME_STATIC_LINKAGE)
set(gtest_force_shared_crt OFF CACHE BOOL "Use shared (DLL) run-time lib even when Google Test is built as static lib." FORCE)
else(RUNTIME_STATIC_LINKAGE)
set(gtest_force_shared_crt ON CACHE BOOL "Use shared (DLL) run-time lib even when Google Test is built as static lib." FORCE)
endif(RUNTIME_STATIC_LINKAGE)
# Orgnize application, libraries, etc. in floders in the IDE.
set_property(GLOBAL PROPERTY USE_FLODERS ON)
# Ensure proper loading of side-loaded shared libraries on all target
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
if(APPLE)
set(CMAKE_INSTALL_RPATH "@loader_path")
elseif(UNIX)
set(CMAKE_INSTALL_RPATH "\$ORIGIN")
endif()
# Don't add the goofy "d" postfix for debug builds of libraries.
set(CMAKE_DEBUG_POSTFIX "")
# Suppress Microsoft warnings about functions being unsafe.
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
# # Google Test
# set(BUILD_GTEST ON CACHE BOOL "Builds the googletest subproject" FORCE)
# set(BUILD_GMOCK OFF CACHE BOOL "Builds the googlemock subproject" FORCE)
# add_subdirectory(googletest)
# set_target_properties(gtest_main gtest PROPERTIES
# FOLDER libraries
# )
add_subdirectory(third_party/libredis)
add_subdirectory(parser)
add_subdirectory(network)
add_subdirectory(meta)
add_subdirectory(executor)
add_subdirectory(server)
endif(ParentDirectory STREQUAL "")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})