3
OPTION(BUILD_TESTS "Create test" ON)
5
set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
7
set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE STRING "Directory where lib will install")
9
set(PKGCONFIG_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig/" CACHE STRING "Base directory for pkgconfig files")
11
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" )
13
find_package(Qt4 REQUIRED)
16
find_package(Carbon REQUIRED)
17
set(CMAKE_INSTALL_NAME_DIR ${LIB_INSTALL_DIR})
18
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
21
if (CMAKE_COMPILER_IS_GNUCXX)
22
if (CMAKE_SYSTEM_NAME MATCHES Linux)
23
add_definitions (-D_BSD_SOURCE)
24
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -ansi -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common")
25
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -fno-check-new -fno-common")
26
endif (CMAKE_SYSTEM_NAME MATCHES Linux)
27
endif (CMAKE_COMPILER_IS_GNUCXX)
29
add_definitions (${QT_DEFINITIONS})
30
INCLUDE_DIRECTORIES(include/QtCrypto/ ${QT_INCLUDES})
32
# Always include srcdir and builddir in include path
33
# This saves typing ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY} in about every subdir
34
set(CMAKE_INCLUDE_CURRENT_DIR ON)
36
# put the include dirs which are in the source or build tree
37
# before all other include dirs, so the headers in the sources
38
# are prefered over the already installed ones
39
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
41
SET(qca_INCLUDEDIR "${CMAKE_CURRENT_SOURCE_DIR}/include" )
42
SET(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib${LIB_SUFFIX}" )
44
set(qca_PLUGINSDIR "${QT_PLUGINS_DIR}/crypto/")
45
MESSAGE(STATUS "Plugins will be installed to " ${qca_PLUGINSDIR})
49
MESSAGE(STATUS "Checking for certstore..")
54
IF ( ENV{QC_CERTSTORE_PATH} )
55
IF(EXISTS ENV{QC_CERTSTORE_PATH})
56
SET( qca_CERTSTORE $ENV{QC_CERTSTORE_PATH})
57
ELSE(EXISTS ENV{QC_CERTSTORE_PATH})
59
ENDIF(EXISTS ENV{QC_CERTSTORE_PATH})
60
ELSE( ENV{QC_CERTSTORE_PATH} )
62
"/etc/ssl/certs/ca-certificates.crt"
63
"/usr/share/ssl/cert.pem"
64
"/usr/share/ssl/certs/ca-bundle.crt"
65
"/etc/pki/tls/cert.pem"
66
"/usr/share/curl/curl-ca-bundle.crt"
68
FOREACH (_current_try ${toTry})
69
IF(EXISTS ${_current_try})
70
SET( qca_CERTSTORE ${_current_try})
71
ENDIF(EXISTS ${_current_try})
72
ENDFOREACH (_current_try)
73
ENDIF( ENV{QC_CERTSTORE_PATH} )
77
MESSAGE(STATUS "Found system certstore")
79
MESSAGE(STATUS "Using built in certstore.")
80
SET( qca_CERTSTORE "${CMAKE_CURRENT_SOURCE_DIR}/certs/rootcerts.pem")
81
# note that INSTALL_FILES targets are relative to the current installation prefix...
82
INSTALL_FILES( "/certs" FILES "${CMAKE_CURRENT_SOURCE_DIR}/certs/rootcerts.pem" )
84
MESSAGE(STATUS "certstore path: " ${qca_CERTSTORE})
85
ADD_DEFINITIONS( -DQCA_SYSTEMSTORE_PATH="\\\"${qca_CERTSTORE}\\\"" )
88
SET( private_HEADERS ${qca_INCLUDEDIR}/QtCrypto/qca_plugin.h ${qca_INCLUDEDIR}/QtCrypto/qca_systemstore.h )
91
${qca_INCLUDEDIR}/QtCrypto/qca.h
92
${qca_INCLUDEDIR}/QtCrypto/qcaprovider.h
93
${qca_INCLUDEDIR}/QtCrypto/QtCrypto
94
${qca_INCLUDEDIR}/QtCrypto/qca_export.h
95
${qca_INCLUDEDIR}/QtCrypto/qca_support.h
96
${qca_INCLUDEDIR}/QtCrypto/qca_tools.h
97
${qca_INCLUDEDIR}/QtCrypto/qca_core.h
98
${qca_INCLUDEDIR}/QtCrypto/qca_textfilter.h
99
${qca_INCLUDEDIR}/QtCrypto/qca_basic.h
100
${qca_INCLUDEDIR}/QtCrypto/qca_publickey.h
101
${qca_INCLUDEDIR}/QtCrypto/qca_cert.h
102
${qca_INCLUDEDIR}/QtCrypto/qca_keystore.h
103
${qca_INCLUDEDIR}/QtCrypto/qca_securelayer.h
104
${qca_INCLUDEDIR}/QtCrypto/qca_securemessage.h
105
${qca_INCLUDEDIR}/QtCrypto/qpipe.h )
107
SET( qca_HEADERS ${private_HEADERS} ${public_HEADERS} )
109
#install public headers only
110
INSTALL(FILES ${public_HEADERS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/QtCrypto")
112
INCLUDE_DIRECTORIES(${QT_QTCORE_INCLUDE_DIR} "${qca_INCLUDEDIR}/QtCrypto")
114
CONFIGURE_FILE("qca.pc.cmake" "${CMAKE_BINARY_DIR}/qca.pc" @ONLY)
115
INSTALL(FILES "${CMAKE_BINARY_DIR}/qca.pc" DESTINATION ${PKGCONFIG_INSTALL_PREFIX})
117
CONFIGURE_FILE("crypto.prf.cmake" "${CMAKE_BINARY_DIR}/crypto.prf" @ONLY)
118
INSTALL(FILES "${CMAKE_BINARY_DIR}/crypto.prf" DESTINATION ${CMAKE_INSTALL_PREFIX}/mkspecs/features)
120
add_subdirectory(src)
121
add_subdirectory(tools)
122
add_subdirectory(plugins)
125
add_subdirectory(unittest)
126
add_subdirectory(examples)