Fix cmake third linking

This commit is contained in:
Quentin Rouland 2019-03-16 19:57:17 +01:00
parent 86643fa46f
commit 6a5c352aed
3 changed files with 27 additions and 19 deletions

View File

@ -13,26 +13,28 @@ add_library(${PLUGIN} MODULE ${SRC})
set_target_properties(${PLUGIN} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PLUGIN}) set_target_properties(${PLUGIN} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PLUGIN})
qt5_use_modules(${PLUGIN} Qml Quick DBus) qt5_use_modules(${PLUGIN} Qml Quick DBus)
set(EXTERNAL_LIBS "${CMAKE_SOURCE_DIR}/local") set(EXTERNAL_LIBS "${CMAKE_SOURCE_DIR}/local")
set(THIRD_PATH "${CMAKE_CURRENT_SOURCE_DIR}") set(THIRD_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
INCLUDE_DIRECTORIES(${EXTERNAL_LIBS}/include) INCLUDE_DIRECTORIES(${EXTERNAL_LIBS}/include)
add_dependencies(${PLUGIN} LibGpgme) add_dependencies(${PLUGIN} LibGpgme)
add_library(target-LibGpgError STATIC IMPORTED) add_library(GpgError STATIC IMPORTED)
set_property(TARGET target-LibGpgError PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libgpg-error.a") set_property(TARGET GpgError PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libgpg-error.a")
add_library(target-LibGpgAssuan STATIC IMPORTED) add_library(GpgAssuan STATIC IMPORTED)
set_property(TARGET target-LibGpgAssuan PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libassuan.a") set_property(TARGET GpgAssuan PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libassuan.a")
add_library(target-LibGpgppme STATIC IMPORTED) add_library(Gpgme STATIC IMPORTED)
set_property(TARGET target-LibGpgppme PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libgpgmepp.a") set_property(TARGET Gpgme PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libgpgme.a")
add_library(target-LibQGpgme STATIC IMPORTED) add_library(Gpgmepp STATIC IMPORTED)
set_property(TARGET target-LibQGpgme PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libqgpgme.a") set_property(TARGET Gpgmepp PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libgpgmepp.a")
target_link_libraries(${PLUGIN} target-LibGpgAssuan target-LibGpgError target-LibGpgppme target-LibQGpgme) add_library(QGpgme STATIC IMPORTED)
set_property(TARGET QGpgme PROPERTY IMPORTED_LOCATION "${EXTERNAL_LIBS}/lib/libqgpgme.a")
target_link_libraries(${PLUGIN} QGpgme Gpgmepp Gpgme GpgAssuan GpgError)
execute_process( execute_process(
COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH

View File

@ -2,17 +2,17 @@
#include <QFile> #include <QFile>
#include "pass.h" #include "pass.h"
#include "gpgme++/global.h" #include "gpgme++/global.h"
#include "gpgme++/engineinfo.h"
#include "qgpgme/protocol.h"
#include "qgpgme/encryptjob.h" #include "qgpgme/encryptjob.h"
#include "qgpgme/decryptjob.h"
#include "qgpgme/keylistjob.h"
Pass::Pass() { Pass::Pass() {
qDebug() << "Initializing GpgMe"; qDebug() << "Initializing GpgMe";
/*auto err = GpgME::initializeLibrary(GpgME::OpenPGP); if(GpgME::initializeLibrary(GpgME::OpenPGP))
if(err) {
qFatal("Fatal error when initializing GpgMe"); qFatal("Fatal error when initializing GpgMe");
}*/ qDebug() << "GpgME Engine Version :" << GpgME::engineInfo(GpgME::GpgEngine).version();
} }
void Pass::speak() { void Pass::speak() {
@ -46,9 +46,15 @@ QString Pass::decrypt_file(const QString path) {
QByteArray Pass::encrypt(const QString str) { QByteArray Pass::encrypt(const QString str) {
/*auto listjob = QGpgME::openpgp()->keyListJob(false, false, false); /*auto listjob = QGpgME::openpgp()->keyListJob(false, false, false);
std::vector<GpgME::Key> keys; std::vector<GpgME::Key> keys;
auto keylistresult = listjob->exec(QStringList() << QStringLiteral("alfa@example.net"), auto keylistresult = listjob->exec(QStringList() << QStringLiteral("alfa@example.net"), false, keys);
false, keys);
auto job = QGpgME::openpgp()->encryptJob(/*ASCII Armor *//*true, /* Textmode *//* true);
auto job = QGpgME::openpgp()
->encryptJob(
true, //ASCII Armor
true //Textmode
);
QByteArray cipherText; QByteArray cipherText;
auto result = job->exec(keys, QStringLiteral("Hello World").toUtf8(), GpgME::Context::AlwaysTrust, cipherText); auto result = job->exec(keys, QStringLiteral("Hello World").toUtf8(), GpgME::Context::AlwaysTrust, cipherText);
return cipherText;*/ return cipherText;*/

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: utpass.qrouland\n" "Project-Id-Version: utpass.qrouland\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-03-16 15:17+0000\n" "POT-Creation-Date: 2019-03-16 17:03+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"