2008-07-21 20:09:29 +00:00
|
|
|
project(QCA)
|
2006-10-02 09:59:51 +00:00
|
|
|
|
2008-07-21 20:09:29 +00:00
|
|
|
cmake_minimum_required(VERSION 2.4.5)
|
2008-05-18 06:50:01 +00:00
|
|
|
|
2008-07-21 20:09:29 +00:00
|
|
|
option(BUILD_TESTS "Create test" ON)
|
2006-10-02 09:59:51 +00:00
|
|
|
|
2006-10-03 12:15:45 +00:00
|
|
|
set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
|
|
|
|
|
2007-01-09 16:14:22 +00:00
|
|
|
set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE STRING "Directory where lib will install")
|
|
|
|
|
2006-10-03 13:00:04 +00:00
|
|
|
set(PKGCONFIG_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig/" CACHE STRING "Base directory for pkgconfig files")
|
|
|
|
|
2006-11-27 18:15:11 +00:00
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" )
|
2006-10-08 06:53:40 +00:00
|
|
|
|
2006-11-27 18:15:11 +00:00
|
|
|
find_package(Qt4 REQUIRED)
|
2008-12-30 10:05:59 +00:00
|
|
|
# properly set up compile flags (QT_DEBUG/QT_NO_DEBUG, ...)
|
|
|
|
include(${QT_USE_FILE})
|
2006-10-02 09:59:51 +00:00
|
|
|
|
2008-07-21 20:09:29 +00:00
|
|
|
set(QCA_LIB_MAJOR_VERSION "2")
|
|
|
|
set(QCA_LIB_MINOR_VERSION "0")
|
2009-04-29 21:43:35 +00:00
|
|
|
set(QCA_LIB_PATCH_VERSION "2")
|
2007-08-26 17:05:22 +00:00
|
|
|
|
2008-07-21 20:09:29 +00:00
|
|
|
set(QCA_LIB_VERSION_STRING "${QCA_LIB_MAJOR_VERSION}.${QCA_LIB_MINOR_VERSION}.${QCA_LIB_PATCH_VERSION}")
|
2007-08-26 17:05:22 +00:00
|
|
|
|
|
|
|
|
2006-10-02 09:59:51 +00:00
|
|
|
if (APPLE)
|
|
|
|
find_package(Carbon REQUIRED)
|
2007-06-03 16:24:50 +00:00
|
|
|
set(CMAKE_INSTALL_NAME_DIR ${LIB_INSTALL_DIR})
|
|
|
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
2006-10-02 09:59:51 +00:00
|
|
|
endif (APPLE)
|
2008-07-21 20:09:29 +00:00
|
|
|
|
2008-07-21 20:25:51 +00:00
|
|
|
# set up RPATH handling, so the libs are found if they are installed to a non-standard location, Alex
|
|
|
|
if (UNIX AND NOT APPLE)
|
|
|
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
|
|
|
set(CMAKE_INSTALL_RPATH "${LIB_INSTALL_DIR}" )
|
|
|
|
endif (UNIX AND NOT APPLE)
|
|
|
|
|
|
|
|
|
2007-09-30 15:54:31 +00:00
|
|
|
if (WIN32)
|
|
|
|
set(CMAKE_DEBUG_POSTFIX "d")
|
|
|
|
endif (WIN32)
|
2006-10-02 09:59:51 +00:00
|
|
|
|
2006-11-27 18:15:11 +00:00
|
|
|
if (CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
if (CMAKE_SYSTEM_NAME MATCHES Linux)
|
2006-11-27 19:06:32 +00:00
|
|
|
add_definitions (-D_BSD_SOURCE)
|
2006-11-27 18:15:11 +00:00
|
|
|
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")
|
|
|
|
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")
|
|
|
|
endif (CMAKE_SYSTEM_NAME MATCHES Linux)
|
|
|
|
endif (CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
|
2006-10-02 09:59:51 +00:00
|
|
|
add_definitions (${QT_DEFINITIONS})
|
2008-07-21 20:09:29 +00:00
|
|
|
include_directories(include/QtCrypto/ ${QT_INCLUDES})
|
2006-10-02 09:59:51 +00:00
|
|
|
|
|
|
|
# Always include srcdir and builddir in include path
|
|
|
|
# This saves typing ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY} in about every subdir
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
|
|
|
|
# put the include dirs which are in the source or build tree
|
|
|
|
# before all other include dirs, so the headers in the sources
|
|
|
|
# are prefered over the already installed ones
|
|
|
|
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
|
|
|
|
|
2008-07-21 20:09:29 +00:00
|
|
|
set(qca_INCLUDEDIR "${CMAKE_CURRENT_SOURCE_DIR}/include" )
|
|
|
|
set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib${LIB_SUFFIX}" )
|
2006-10-02 09:59:51 +00:00
|
|
|
|
2008-02-03 10:34:35 +00:00
|
|
|
set(qca_PLUGINSDIR "${QT_PLUGINS_DIR}/crypto/")
|
2008-07-21 20:09:29 +00:00
|
|
|
message(STATUS "Plugins will be installed to " ${qca_PLUGINSDIR})
|
2006-10-02 15:52:23 +00:00
|
|
|
|
2006-10-02 09:59:51 +00:00
|
|
|
include(QcaMacro)
|
|
|
|
|
2008-07-21 20:09:29 +00:00
|
|
|
message(STATUS "Checking for certstore..")
|
2006-10-02 09:59:51 +00:00
|
|
|
# fixme add OR mac
|
2008-07-21 20:09:29 +00:00
|
|
|
if( WIN32 )
|
2006-10-02 09:59:51 +00:00
|
|
|
# USE BUILTIN
|
2008-07-21 20:09:29 +00:00
|
|
|
else ( WIN32 )
|
|
|
|
if ( ENV{QC_CERTSTORE_PATH} )
|
|
|
|
if(EXISTS ENV{QC_CERTSTORE_PATH})
|
|
|
|
set( qca_CERTSTORE $ENV{QC_CERTSTORE_PATH})
|
|
|
|
else(EXISTS ENV{QC_CERTSTORE_PATH})
|
|
|
|
# path to try
|
|
|
|
endif(EXISTS ENV{QC_CERTSTORE_PATH})
|
|
|
|
else( ENV{QC_CERTSTORE_PATH} )
|
|
|
|
set( toTry
|
2006-10-02 09:59:51 +00:00
|
|
|
"/etc/ssl/certs/ca-certificates.crt"
|
|
|
|
"/usr/share/ssl/cert.pem"
|
|
|
|
"/usr/share/ssl/certs/ca-bundle.crt"
|
|
|
|
"/etc/pki/tls/cert.pem"
|
2007-01-05 19:16:06 +00:00
|
|
|
"/usr/share/curl/curl-ca-bundle.crt"
|
2006-10-02 09:59:51 +00:00
|
|
|
)
|
2008-07-21 20:09:29 +00:00
|
|
|
foreach (_current_try ${toTry})
|
|
|
|
if(EXISTS ${_current_try})
|
|
|
|
set( qca_CERTSTORE ${_current_try})
|
|
|
|
endif(EXISTS ${_current_try})
|
|
|
|
endforeach (_current_try)
|
|
|
|
endif( ENV{QC_CERTSTORE_PATH} )
|
|
|
|
endif(WIN32)
|
|
|
|
|
|
|
|
if (qca_CERTSTORE)
|
|
|
|
message(STATUS "Found system certstore")
|
|
|
|
else (qca_CERTSTORE)
|
|
|
|
message(STATUS "Using built in certstore.")
|
|
|
|
set( qca_CERTSTORE "${CMAKE_CURRENT_SOURCE_DIR}/certs/rootcerts.pem")
|
2006-12-21 04:18:17 +00:00
|
|
|
# note that INSTALL_FILES targets are relative to the current installation prefix...
|
2008-07-21 20:09:29 +00:00
|
|
|
install_files( "/certs" FILES "${CMAKE_CURRENT_SOURCE_DIR}/certs/rootcerts.pem" )
|
|
|
|
endif (qca_CERTSTORE)
|
|
|
|
message(STATUS "certstore path: " ${qca_CERTSTORE})
|
|
|
|
add_definitions( -DQCA_SYSTEMSTORE_PATH="\\\"${qca_CERTSTORE}\\\"" )
|
2006-10-02 09:59:51 +00:00
|
|
|
|
|
|
|
|
2008-07-21 20:09:29 +00:00
|
|
|
set( private_HEADERS ${qca_INCLUDEDIR}/QtCrypto/qca_plugin.h ${qca_INCLUDEDIR}/QtCrypto/qca_systemstore.h )
|
2006-10-02 09:59:51 +00:00
|
|
|
|
2008-07-21 20:09:29 +00:00
|
|
|
set( public_HEADERS
|
2006-10-02 09:59:51 +00:00
|
|
|
${qca_INCLUDEDIR}/QtCrypto/qca.h
|
|
|
|
${qca_INCLUDEDIR}/QtCrypto/qcaprovider.h
|
|
|
|
${qca_INCLUDEDIR}/QtCrypto/QtCrypto
|
|
|
|
${qca_INCLUDEDIR}/QtCrypto/qca_export.h
|
2008-07-21 20:09:29 +00:00
|
|
|
${qca_INCLUDEDIR}/QtCrypto/qca_support.h
|
|
|
|
${qca_INCLUDEDIR}/QtCrypto/qca_tools.h
|
|
|
|
${qca_INCLUDEDIR}/QtCrypto/qca_core.h
|
|
|
|
${qca_INCLUDEDIR}/QtCrypto/qca_textfilter.h
|
|
|
|
${qca_INCLUDEDIR}/QtCrypto/qca_basic.h
|
|
|
|
${qca_INCLUDEDIR}/QtCrypto/qca_publickey.h
|
|
|
|
${qca_INCLUDEDIR}/QtCrypto/qca_cert.h
|
|
|
|
${qca_INCLUDEDIR}/QtCrypto/qca_keystore.h
|
|
|
|
${qca_INCLUDEDIR}/QtCrypto/qca_securelayer.h
|
|
|
|
${qca_INCLUDEDIR}/QtCrypto/qca_securemessage.h
|
|
|
|
${qca_INCLUDEDIR}/QtCrypto/qpipe.h )
|
|
|
|
|
|
|
|
set( qca_HEADERS ${private_HEADERS} ${public_HEADERS} )
|
2006-10-02 09:59:51 +00:00
|
|
|
|
|
|
|
#install public headers only
|
2008-07-21 20:09:29 +00:00
|
|
|
install(FILES ${public_HEADERS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/QtCrypto")
|
2006-10-02 09:59:51 +00:00
|
|
|
|
2008-07-21 20:09:29 +00:00
|
|
|
include_directories(${QT_QTCORE_INCLUDE_DIR} "${qca_INCLUDEDIR}/QtCrypto")
|
2006-10-02 09:59:51 +00:00
|
|
|
|
2007-08-14 07:31:41 +00:00
|
|
|
if(NOT WIN32)
|
2008-07-21 20:09:29 +00:00
|
|
|
configure_file("qca2.pc.cmake" "${CMAKE_BINARY_DIR}/qca2.pc" @ONLY)
|
|
|
|
install(FILES "${CMAKE_BINARY_DIR}/qca2.pc" DESTINATION ${PKGCONFIG_INSTALL_PREFIX})
|
2007-08-14 07:31:41 +00:00
|
|
|
endif(NOT WIN32)
|
2006-10-02 09:59:51 +00:00
|
|
|
|
2008-07-21 20:09:29 +00:00
|
|
|
configure_file("crypto.prf.cmake" "${CMAKE_BINARY_DIR}/crypto.prf" @ONLY)
|
|
|
|
install(FILES "${CMAKE_BINARY_DIR}/crypto.prf" DESTINATION ${CMAKE_INSTALL_PREFIX}/mkspecs/features)
|
2006-10-02 09:59:51 +00:00
|
|
|
|
2007-10-18 14:31:08 +00:00
|
|
|
install(FILES man/qcatool2.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1)
|
|
|
|
|
2006-10-02 09:59:51 +00:00
|
|
|
add_subdirectory(src)
|
|
|
|
add_subdirectory(tools)
|
2006-10-02 15:18:50 +00:00
|
|
|
add_subdirectory(plugins)
|
2008-07-21 20:09:29 +00:00
|
|
|
|
2006-10-02 09:59:51 +00:00
|
|
|
if(BUILD_TESTS)
|
2008-07-21 20:09:29 +00:00
|
|
|
enable_testing()
|
|
|
|
add_subdirectory(unittest)
|
|
|
|
add_subdirectory(examples)
|
2006-10-02 09:59:51 +00:00
|
|
|
endif(BUILD_TESTS)
|
|
|
|
|