-
Notifications
You must be signed in to change notification settings - Fork 139
/
CMakeLists.txt
81 lines (67 loc) · 2.23 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
cmake_minimum_required(VERSION 3.0)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
project(pss)
#check ace environmental variable
if(NOT DEFINED ENV{ACE_ROOT})
message("ACE no find install VS_DEVENV_PATH=${VS_DEVENV_PATH}")
else()
message("ACE find install VS_DEVENV_PATH=${VS_DEVENV_PATH}")
#check cxx flag in linux system
if(UNIX)
#linux
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
endif()
########################################################################
set(ROOT_DIR ${PROJECT_SOURCE_DIR})
if(UNIX)
#linux
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g -ggdb -fPIC")
if(CMAKE_BUILD_TYPE MATCHES "debug")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -D_DEBUG ")
else()
set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -DNDEBUG")
endif()
set(LDFLAGS "$ENV{LDFLAGS} -stdlib=libc++")
#TODO:3rd lib dir
set(DEP_LIB_DIR ${ACE_ROOT}/lib/)
add_definitions(-Wno-unused-variable -Wno-unused-parameter -Wno-unused-function -Wno-strict-aliasing -Wno-pmf-conversions)
#OPTION:coverage
#if(ENABLE_COVERAGE)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
#endif()
else()
#windows
set(DEP_LIB_DIR ${ACE_ROOT}/lib/)
set(BIN_OUTPUT_DIR ${ROOT_DIR}/Build/Windows)
add_definitions(
-DWIN
-D_WINDOWS
-D_CRT_SECURE_NO_WARNINGS)
if(CMAKE_BUILD_TYPE MATCHES "debug")
add_definitions(-D_DEBUG)
else(CMAKE_BUILD_TYPE MATCHES "debug")
add_definitions(-DNDEBUG)
endif(CMAKE_BUILD_TYPE MATCHES "debug")
endif()
#log
message("ROOT dir=${ROOT_DIR}")
#message("Bin Output dir=${BIN_OUTPUT_DIR}")
#message("DEP lib dir=${DEP_LIB_DIR}")
#message("Plugin Output=${LIB_OUTPUT_DIR}")
message("CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}")
#codecov
#find_package(codecov)
##################################################################
message("Start to build all...")
#add your own sub dirs
add_subdirectory(purenessscopeserver)
#TODO:add other dirs
endif()