-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
49 lines (43 loc) · 1.19 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
cmake_minimum_required(VERSION 2.8)
set(project_name xorm)
project(${project_name})
SET(ENABLE_XORM ON)
SET(ENABLE_MYSQL ON)
SET(ENABLE_SQLITE OFF)
SET(ENABLE_SQLITE_CODEC OFF)
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++latest")
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:")
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()
set(SOURCE_FILES main.cpp)
include_directories(${CMAKE_SOURCE_DIR}/xorm)
add_executable(${project_name} ${SOURCE_FILES})
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()
install(TARGETS ${project_name} DESTINATION include)