Set DISPLAY environment variable if --display option
[pinentry-qt.git] / CMakeLists.txt
1 project(pinentry-qt)
2 cmake_minimum_required(VERSION 2.6.0)
3
4 set(PINENTRY_QT_VERSION_MAJOR "0")
5 set(PINENTRY_QT_VERSION_MINOR "5")
6 set(PINENTRY_QT_VERSION_PATCH "0")
7
8 set(PINENTRY_QT_VERSION "${PINENTRY_QT_VERSION_MAJOR}.${PINENTRY_QT_VERSION_MINOR}.${PINENTRY_QT_VERSION_PATCH}")
9
10 add_definitions(-DVERSION="${PINENTRY_QT_VERSION}")
11
12 # Checks
13 find_package(Qt4 REQUIRED)
14
15 include(CheckIncludeFiles)
16 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
17 add_definitions(-DHAVE_CONFIG_H=1)
18
19 if(WIN32)
20 add_definitions(-D_CRT_SECURE_NO_WARNINGS)
21 add_definitions(-DHAVE_W32_SYSTEM=1)
22 add_definitions(-DHAVE_DOSISH_SYSTEM=1)
23 endif(WIN32)
24 if(WINCE)
25 add_definitions(-DHAVE_W32CE_SYSTEM=1)
26 endif(WINCE)
27
28 # Build rules
29 #   set(QT_USE_OPENGL TRUE)
30 include(${QT_USE_FILE})
31
32 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
33
34 set(pinentry_qt_SRCS
35     qrc_pinentry.cpp   
36     pinentrydialog.cpp
37     main.cpp
38     assuan-buffer.c
39     assuan-defs.h
40     assuan-errors.c
41     assuan.h
42     assuan-handler.c
43     assuan-listen.c
44     assuan-pipe-server.c
45     assuan-util.c
46     memory.h
47     secmem-util.h
48     secmem-util.c
49     secmem.c
50     pinentry.c
51     getopt.h
52     getopt.c
53 )
54
55 # Automatically figure out moc files.
56 qt4_automoc(${qtproject_SRCS})
57
58 add_executable(pinentry-qt ${pinentry_qt_SRCS})
59 target_link_libraries(pinentry-qt ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
60 install(TARGETS pinentry-qt DESTINATION bin)
61
62
63 # Packaging
64 set(CPACK_PACKAGE_VENDOR "g10 Code GmbH")
65 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Pinentry Qt4")
66 set(CPACK_PACKAGE_VERSION_MAJOR ${PINENTRY_QT_VERSION_MAJOR})
67 set(CPACK_PACKAGE_VERSION_MINOR ${PINENTRY_QT_VERSION_MINOR})
68 set(CPACK_PACKAGE_VERSION_PATCH ${PINENTRY_QT_VERSION_PATCH})
69 if (APPLE)
70 #  set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/cpack/README.txt")
71 #  set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/cpack/LICENSE.txt")
72   set(CPACK_SET_DESTDIR ON)
73   set(CPACK_PACKAGE_RELOCATABLE OFF)
74 endif (APPLE)
75   
76 include(CPack)