4
0
mirror of https://github.com/QuasarApp/qca.git synced 2025-05-14 11:29:33 +00:00
Ivan Romanov 6d690c0070 Build static QCA
Added new cmake variable SHARED_LIBRARY. By default is on.
When it is off QCA library, plugins, tools, examples and unittests
will be built as static. Also if is used static Qt plugins will be
built as static. Tested with Qt4.
2014-01-02 03:50:18 +06:00

56 lines
1.7 KiB
CMake

# QCA OSSL
if(WITH_ossl_PLUGIN STREQUAL "yes")
find_package(OpenSSL REQUIRED)
else(WITH_ossl_PLUGIN STREQUAL "yes")
find_package(OpenSSL)
endif(WITH_ossl_PLUGIN STREQUAL "yes")
if(OPENSSL_FOUND)
enable_plugin("ossl")
include(CheckFunctionExists)
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES})
check_function_exists(EVP_md2 HAVE_OPENSSL_MD2)
if(HAVE_OPENSSL_MD2)
add_definitions(-DHAVE_OPENSSL_MD2)
else(HAVE_OPENSSL_MD2)
message(WARNING "qca-ossl will be compiled without MD2 digest algorithm support")
endif(HAVE_OPENSSL_MD2)
check_function_exists(EVP_aes_128_ctr HAVE_OPENSSL_AES_CTR)
if(HAVE_OPENSSL_AES_CTR)
add_definitions(-DHAVE_OPENSSL_AES_CTR)
else(HAVE_OPENSSL_AES_CTR)
message(WARNING "qca-ossl will be compiled without AES CTR mode encryption support")
endif(HAVE_OPENSSL_AES_CTR)
set(QCA_OSSL_SOURCES qca-ossl.cpp)
my_automoc( QCA_OSSL_SOURCES )
add_library(qca-ossl ${PLUGIN_TYPE} ${QCA_OSSL_SOURCES})
include_directories(${OPENSSL_INCLUDE_DIR})
target_link_libraries(qca-ossl ${QT_QTCORE_LIBRARY})
target_link_libraries(qca-ossl ${QCA_LIB_NAME})
target_link_libraries(qca-ossl ${OPENSSL_LIBRARIES})
if(APPLE)
target_link_libraries(qca-ossl crypto)
endif(APPLE)
if(WIN32)
add_definitions(-DOSSL_097)
target_link_libraries(qca-ossl gdi32)
target_link_libraries(qca-ossl wsock32)
target_link_libraries(qca-ossl ${OPENSSL_EAY_LIBRARIES})
endif(WIN32)
install(TARGETS qca-ossl
LIBRARY DESTINATION "${QCA_PLUGINS_INSTALL_DIR}"
ARCHIVE DESTINATION "${QCA_PLUGINS_INSTALL_DIR}"
RUNTIME DESTINATION "${QCA_PLUGINS_INSTALL_DIR}")
else(OPENSSL_FOUND)
disable_plugin("ossl")
endif(OPENSSL_FOUND)