~keepassx/keepassx/debian

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
# CMake is still experimental, use qmake instead

PROJECT(KeePassX)

CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR)

MESSAGE("CMake is still experimental, use qmake instead")

SET( keepassx_VERSION_SHORT "0.4.0" )
SET( keepassx_VERSION "0.4.0" )

ADD_DEFINITIONS(-D'KEEPASSX_VERSION="${keepassx_VERSION}"')

#Set the custom CMake module directory where our include/lib finders are
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

IF( APPLE OR MINGW )
	SET( PROGNAME KeePassX )
ELSE( APPLE OR MINGW )
	SET( PROGNAME keepassx )
ENDIF( APPLE OR MINGW )

IF( APPLE )
	SET( MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/share/macx_bundle/Info_cmake.plist )
	SET( MACOSX_BUNDLE_ICON_FILE ${CMAKE_CURRENT_SOURCE_DIR}/share/macx_bundle/icon.icns )
	SET( MACOSX_BUNDLE_INFO_STRING KeePassX v${keepassx_VERSION} )
	SET( MACOSX_BUNDLE_VERSION ${keepassx_VERSION} )
	SET( MACOSX_BUNDLE_SHORT_VERSION_STRING ${keepassx_VERSION_SHORT} )
	SET( MACOSX_BUNDLE_LONG_VERSION_STRING Version ${keepassx_VERSION} )
	SET( CMAKE_OSX_ARCHITECTURES ppc;i386 )
ENDIF( APPLE )

IF( MINGW )
	FIND_PROGRAM(CMAKE_RC NAMES ${_CMAKE_TOOLCHAIN_PREFIX}windres HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
	
	ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/keepassx.o
		COMMAND ${CMAKE_RC} -I${CMAKE_CURRENT_SOURCE_DIR}
		-i${CMAKE_CURRENT_SOURCE_DIR}/share/win_ico/keepassx.rc -o ${CMAKE_CURRENT_BINARY_DIR}/keepassx.o )
	SET(keepassx_RCS ${CMAKE_CURRENT_BINARY_DIR}/keepassx.o)
ENDIF( MINGW )


OPTION(PRECOMPILED_HEADER "Enable precompiled header (required gcc >= 3.4.0)" TRUE)
IF( APPLE OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD )
	SET(PRECOMPILED_HEADER FALSE)
ENDIF( APPLE OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD )

IF( PRECOMPILED_HEADER )
	FIND_PACKAGE(PCHSupport)
	IF(NOT PCHSupport_FOUND)
		SET(PRECOMPILED_HEADER FALSE)
	ENDIF(NOT PCHSupport_FOUND)
ENDIF( PRECOMPILED_HEADER )


SET(QT_MIN_VERSION "4.3.0")
SET(QT_USE_QTXML TRUE)
SET(QT_USE_QTMAIN TRUE)
FIND_PACKAGE(Qt4 REQUIRED)
INCLUDE(${QT_USE_FILE})


OPTION(AUTOTYPE "Enable auto-type (X11 only)" TRUE)

IF( NOT UNIX )
	SET(AUTOTYPE FALSE)
ENDIF( NOT UNIX )

IF( AUTOTYPE )
	find_package(X11)
	
	IF( X11_XTest_FOUND )
		INCLUDE_DIRECTORIES( ${X11_X11_INCLUDE_PATH} ${X11_XTest_INCLUDE_PATH} )
		SET(AUTOTYPE_LIBRARIES ${X11_X11_LIB} ${X11_XTest_LIB})
		ADD_DEFINITIONS(-DAUTOTYPE -DGLOBAL_AUTOTYPE)
	ELSE( X11_XTest_FOUND )
		SET(AUTOTYPE FALSE)
	ENDIF( X11_XTest_FOUND )
ENDIF( AUTOTYPE )


IF( MINGW )
	SET(BINDIR "")
	SET(SHAREDIR "share")
ELSEIF( APPLE )
	SET(BINDIR "")
	SET(SHAREDIR "Contents/Resources")
ELSE( MINGW )
	SET(BINDIR "bin")
	SET(SHAREDIR "share/keepassx")
	SET(SHAREDIR_APP "share")
ENDIF( MINGW )


ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(share)