-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
153 lines (126 loc) · 4.14 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
project(${PLUGIN_NAME})
# Written to work with cmake 2.6
cmake_minimum_required (VERSION 2.6)
set (CMAKE_BACKWARDS_COMPATIBILITY 2.6)
# Options which affect the way the project is built
set(ENABLE_DEBUG FALSE
CACHE BOOL "Set to TRUE to enable debug print statements (default: FALSE)"
)
option(ENABLE_OLD_APIS "Support OLD API-s (default: TRUE)" TRUE)
option(ENABLE_RUN_IN_SOURCE_TREE "Enable search for the config file and UI files in local directory" FALSE)
# FIXME: Merge with libdigidocpp/CMakeLists.txt and create a proper
# cmake module that is used by qesteidutil as well
if(WIN32)
set(PKCS11_MODULE_NAME "onepin-opensc-pkcs11.dll")
else()
set(PKCS11_MODULE_NAME "onepin-opensc-pkcs11.so")
endif()
IF(PKCS11_MODULE_DIR)
SET(PKCS11_MODULE "${PKCS11_MODULE_DIR}/${PKCS11_MODULE_NAME}")
ENDIF(PKCS11_MODULE_DIR)
find_package(Subversion)
if(Subversion_FOUND AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.svn)
Subversion_WC_INFO(${CMAKE_CURRENT_SOURCE_DIR} PROJECT)
set(SVN_REV ${PROJECT_WC_LAST_CHANGED_REV})
message(STATUS "Current subversion revision is ${SVN_REV}")
else()
message( "Unable to determine subversion revision")
endif()
# Custom cmake modules
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
include(InstallSettings)
find_package(Gettext)
find_package(Iconv REQUIRED)
find_package(OpenSSLCrypto REQUIRED)
find_package(SmartCardpp REQUIRED)
if (UNIX)
find_package(PCSCLite)
endif()
if (WITH_SYSTEM_BOOST)
# FindBoost.cmake isn't up to date wrt new boost versions
set(Boost_ADDITIONAL_VERSIONS "1.44" "1.44.0" "1.43" "1.43.0" "1.42" "1.42.0")
if (WIN32)
# boost::signals is only needed for Windows UI code
set(EXTRA_BOOST_COMPONENTS "signals")
endif()
find_package(Boost 1.41.0 COMPONENTS filesystem system thread ${EXTRA_BOOST_COMPONENTS} REQUIRED)
else()
message(STATUS "Using bundled boost")
if (WIN32)
# boost::signals is only needed for Windows UI code
add_boost_library(signals)
endif()
add_boost_library(filesystem)
add_boost_library(system)
add_boost_library(thread)
endif()
if(UNIX AND NOT APPLE)
if(NOT GTKMM_INCLUDE_DIRS)
pkg_check_modules(GTKMM REQUIRED gtkmm-2.4)
endif()
endif(UNIX AND NOT APPLE)
if(ICONV_SECOND_ARGUMENT_IS_CONST)
add_definitions( -DICONV_SECOND_ARGUMENT_IS_CONST )
endif(ICONV_SECOND_ARGUMENT_IS_CONST)
if(ENABLE_DEBUG)
message(STATUS "Debug print statements are enabled")
else()
add_definitions(-DNDEBUG)
endif()
if(ENABLE_OLD_APIS)
message(STATUS "Support for OLD API-s is enabled")
add_definitions(-DSUPPORT_OLD_APIS)
endif(ENABLE_OLD_APIS)
include_directories(
${PLUGIN_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${GTKMM_INCLUDE_DIRS}
${ICONV_INCLUDE_DIR}
${OPENSSLCRYPTO_INCLUDE_DIR}
${PCSCLITE_INCLUDE_DIR}
${SMARTCARDPP_INCLUDE_DIRS}
${UTIL_DIR}
)
if( APPLE )
include_directories( /usr/local/include/../include )
endif( APPLE )
file (GLOB GENERAL RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.cpp
*.h
*.cmake
)
# Generated files are stored in ${GENERATED} by the project configuration
SET_SOURCE_FILES_PROPERTIES(
${GENERATED}
PROPERTIES
GENERATED 1
)
SOURCE_GROUP(Generated FILES
${GENERATED}
)
SET( SOURCES
${GENERAL}
${GENERATED}
)
if (ENABLE_RUN_IN_SOURCE_TREE)
set(ESTEID_CONFIGDIR "${CMAKE_CURRENT_SOURCE_DIR}")
else()
set(ESTEID_CONFIGDIR "${SYSCONF_INSTALL_DIR}")
endif()
include(CheckIncludeFiles)
check_include_files(libintl.h HAVE_LIBINTL_H)
set(ESTEID_LOCALEDIR ${SHARE_INSTALL_PREFIX}/locale)
if(GETTEXT_FOUND AND HAVE_LIBINTL_H)
# Generate translations
file(GLOB PO_FILES po/*.po)
gettext_create_translations(po/esteid-browser-plugin.pot ALL ${PO_FILES})
else()
message(STATUS "Gettext or libintl not found, skipping translations")
endif()
configure_file(esteid-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/esteid-config.h)
# This will include Win/projectDef.cmake, Linux/projectDef.cmake, etc
include_platform()
add_subdirectory(Mozilla)
install(FILES esteid-browser-plugin.conf DESTINATION ${ESTEID_CONFIGDIR})