~hrvojem/percona-xtrabackup/rn-2.1.0-beta1

« back to all changes in this revision

Viewing changes to CMakeLists.txt

  • Committer: Alexey Kopytov
  • Date: 2011-04-21 06:36:29 UTC
  • mto: This revision was merged to the branch mainline in revision 249.
  • Revision ID: akopytov@gmail.com-20110421063629-s951sxdgt2gi93xw
Added initial support for Windows builds:

- removed the compatibility symlink from the source tree, it will be
created when packaging once the necessary changes are merged from the
release branch

- abstracted away regex API into xb_regex.h so we can use native regex
on POSIX systems and my_regex on Windows

- fixed a number of code issues which Visual Studio builds

- added CMakeLists.txt

- added building instructions in BUILD-WIN.txt

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 
2
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.6)
 
3
  CMAKE_POLICY(VERSION 2.8)
 
4
ENDIF()
 
5
 
 
6
IF (NOT DEFINED MYSQL_ROOT_DIR)
 
7
  MESSAGE(FATAL_ERROR
 
8
    "You must specify a path to the server source directory with
 
9
 -DMYSQL_ROOT_DIR")
 
10
ENDIF()
 
11
 
 
12
if(COMMAND cmake_policy)
 
13
   cmake_policy(SET CMP0015 NEW)
 
14
endif(COMMAND cmake_policy)
 
15
 
 
16
LINK_DIRECTORIES (
 
17
  ${MYSQL_ROOT_DIR}/mysys/RelWithDebInfo
 
18
  ${MYSQL_ROOT_DIR}/strings/RelWithDebInfo
 
19
  ${MYSQL_ROOT_DIR}/storage/innobase/RelWithDebInfo
 
20
  ${MYSQL_ROOT_DIR}/zlib/RelWithDebInfo
 
21
  ${MYSQL_ROOT_DIR}/regex/RelWithDebInfo
 
22
)
 
23
 
 
24
PROJECT(XtraBackup)
 
25
ADD_EXECUTABLE(xtrabackup
 
26
  xtrabackup.c
 
27
  xb_regex.h
 
28
)
 
29
 
 
30
if(COMMAND cmake_policy)
 
31
   cmake_policy(SET CMP0016 NEW)
 
32
endif(COMMAND cmake_policy)
 
33
 
 
34
# Enable debug info also in Release build, and create PDB to be able to
 
35
# analyze crashes
 
36
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Zi")
 
37
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /debug")
 
38
 
 
39
# Force static runtime libraries
 
40
FOREACH(flag
 
41
    CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
 
42
    CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
 
43
    CMAKE_CXX_FLAGS_RELEASE  CMAKE_CXX_FLAGS_RELWITHDEBINFO
 
44
    CMAKE_CXX_FLAGS_DEBUG  CMAKE_CXX_FLAGS_DEBUG_INIT)
 
45
  STRING(REPLACE "/MD"  "/MT" "${flag}" "${${flag}}")
 
46
ENDFOREACH()
 
47
 
 
48
# Silence "deprecated API" warnings.
 
49
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996")
 
50
 
 
51
INCLUDE_DIRECTORIES(
 
52
  ${MYSQL_ROOT_DIR}/include
 
53
  ${MYSQL_ROOT_DIR}/regex
 
54
  ${MYSQL_ROOT_DIR}/storage/innobase/include
 
55
)
 
56
 
 
57
TARGET_LINK_LIBRARIES(xtrabackup mysys strings innobase zlib regex)
 
58
ADD_DEFINITIONS(-DDBUG_OFF -DHAVE_CONFIG_H -DWIN_ASYNC_IO
 
59
  -DHAVE_WINDOWS_ATOMICS)