-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
77 lines (63 loc) · 2 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
cmake_minimum_required(VERSION 2.8)
set(project_name xmart)
project(${project_name})
set(CMAKE_BUILD_TYPE Release)
SET(ENABLE_CLIENT_SSL OFF)
SET(ENABLE_XORM ON)
SET(ENABLE_MYSQL ON)
SET(ENABLE_SQLITE OFF)
SET(ENABLE_SQLITE_CODEC OFF)
#SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++11 /utf-8 /bigobj")
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++11")
endif ()
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
set(CMAKE_INSTALL_RPATH "/usr/local/lib:")
#set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
if(ENABLE_XORM)
add_definitions(-D_ENABLE_XORM_)
if(ENABLE_MYSQL)
add_definitions(-DXORM_ENABLE_MYSQL)
endif()
if(ENABLE_SQLITE)
add_definitions(-DXORM_ENABLE_SQLITE)
if(ENABLE_SQLITE_CODEC)
add_definitions(-DSQLITE_HAS_CODEC)
endif()
endif()
endif()
add_definitions(-DASIO_STANDALONE)
if(ENABLE_CLIENT_SSL)
add_definitions(-DXFINAL_ENABLE_CLIENT_SSL)
endif()
if (ENABLE_CLIENT_SSL)
find_package(OpenSSL REQUIRED)
endif()
set(Xmart xmart.hpp main.cpp)
add_executable(${project_name} ${Xmart})
if(ENABLE_XORM)
if(ENABLE_MYSQL)
if(MSVC)
target_link_libraries(${project_name} libmysql)
else()
target_link_libraries(${project_name} mysqlclient)
endif()
endif()
if(ENABLE_SQLITE)
target_link_libraries(${project_name} sqlite3)
endif()
endif()
if(ENABLE_CLIENT_SSL)
include_directories(${CMAKE_SOURCE_DIR}/xfinal ${CMAKE_SOURCE_DIR}/xorm ${CMAKE_SOURCE_DIR}/xfinal/asio/asio/include ${CMAKE_SOURCE_DIR}/xfinal/xfinal/ghc ${OPENSSL_INCLUDE_DIR})
else()
include_directories(${CMAKE_SOURCE_DIR}/xfinal ${CMAKE_SOURCE_DIR}/xorm ${CMAKE_SOURCE_DIR}/xfinal/asio/asio/include ${CMAKE_SOURCE_DIR}/xfinal/xfinal/ghc)
endif()
if(ENABLE_CLIENT_SSL)
target_link_libraries(${project_name} uuid ${OPENSSL_LIBRARIES})
else()
target_link_libraries(${project_name} uuid)
endif()
install(TARGETS ${project_name} DESTINATION include)