diff --git a/native/cpp/CommonCpp/CryptoTools/CMakeLists.txt b/native/cpp/CommonCpp/CryptoTools/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/native/cpp/CommonCpp/CryptoTools/CMakeLists.txt @@ -0,0 +1,58 @@ +project(comm-cryptotools) +cmake_minimum_required(VERSION 3.4) + +include(GNUInstallDirs) + +set(CRYPTO_HDRS + "CryptoModule.h" + "Persist.h" + "Session.h" + "Tools.h" +) + +set(CRYPTO_SRCS + "CryptoModule.cpp" + "Session.cpp" + "Tools.cpp" +) + +add_library(comm-cryptotools + ${CRYPTO_HDRS} + ${CRYPTO_SRCS} +) + +find_package(Olm) + +target_link_libraries(comm-cryptotools + Olm +) + +# reference local directory when building, use installation path when installing +target_include_directories(comm-cryptotools + PUBLIC + $ + $ + $ + $ +) + +install(TARGETS comm-cryptotools EXPORT comm-cryptotools-export + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT comm-cryptotools + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT comm-cryptotools + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT comm-cryptotools +) + +install(FILES ${TOOLS_HDRS} DESTINATION include/Tools) + +set(_builddir_export_path cmake/comm-cryptotools/comm-cryptotools-targets.cmake) +export(TARGETS comm-cryptotools + NAMESPACE comm-cryptotools:: + FILE ${CMAKE_CURRENT_BINARY_DIR}/${_builddir_export_path} +) + +# For installation +install(EXPORT comm-cryptotools-export + FILE comm-cryptotools-targets.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/comm-cryptotools + NAMESPACE comm-cryptotools:: +) diff --git a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp --- a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp +++ b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp @@ -2,6 +2,8 @@ #include "PlatformSpecificTools.h" #include "olm/session.hh" +#include + namespace comm { namespace crypto { diff --git a/native/cpp/CommonCpp/CryptoTools/Session.cpp b/native/cpp/CommonCpp/CryptoTools/Session.cpp --- a/native/cpp/CommonCpp/CryptoTools/Session.cpp +++ b/native/cpp/CommonCpp/CryptoTools/Session.cpp @@ -1,6 +1,8 @@ #include "Session.h" #include "PlatformSpecificTools.h" +#include + namespace comm { namespace crypto { diff --git a/native/cpp/CommonCpp/CryptoTools/Tools.h b/native/cpp/CommonCpp/CryptoTools/Tools.h --- a/native/cpp/CommonCpp/CryptoTools/Tools.h +++ b/native/cpp/CommonCpp/CryptoTools/Tools.h @@ -1,5 +1,7 @@ #pragma once +#include +#include #include #include "olm/olm.h"