Skip to content
Snippets Groups Projects
Commit 0b28322a authored by Konstantinos Sideris's avatar Konstantinos Sideris
Browse files

Add libolm as dependency

parent 477e4d41
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ project(matrix_client CXX)
option(BUILD_LIB_TESTS "Build tests" ON)
option(BUILD_LIB_EXAMPLES "Build examples" ON)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
......@@ -53,7 +54,7 @@ find_package(Boost 1.66 COMPONENTS system random thread)
if(NOT Boost_FOUND)
message(STATUS "Fetching and building Boost 1.66")
include(${CMAKE_SOURCE_DIR}/cmake/Boost.cmake)
include(Boost)
endif()
include_directories(${Boost_INCLUDE_DIRS})
......@@ -61,15 +62,20 @@ include_directories(${Boost_INCLUDE_DIRS})
#
# matrix-structs
#
include(${CMAKE_SOURCE_DIR}/cmake/MatrixStructs.cmake)
include(MatrixStructs)
#
# libolm
#
include(Olm)
include_directories(src)
include_directories(${MATRIX_STRUCTS_INCLUDE_DIRS})
set(SRC src/client.cpp src/utils.cpp)
add_library(matrix_client ${SRC})
add_dependencies(matrix_client MatrixStructs)
target_link_libraries(matrix_client matrix_structs ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES})
add_dependencies(matrix_client MatrixStructs Olm)
target_link_libraries(matrix_client matrix_structs olm ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES})
if(NOT Boost_FOUND)
add_dependencies(matrix_client Boost)
......
include(ExternalProject)
#
# Build & install olm.
#
set(THIRD_PARTY_ROOT ${CMAKE_SOURCE_DIR}/.third-party)
set(OLM_ROOT ${THIRD_PARTY_ROOT}/olm)
ExternalProject_Add(
Olm
GIT_REPOSITORY https://git.matrix.org/git/olm.git
GIT_TAG 3f5b9dd6d72540a66da90b382a2eda088af63da0
BUILD_IN_SOURCE 1
SOURCE_DIR ${OLM_ROOT}
CONFIGURE_COMMAND ""
BUILD_COMMAND make static
INSTALL_COMMAND ""
)
include_directories(SYSTEM ${OLM_ROOT}/include ${OLM_ROOT}/include/olm)
link_directories(${OLM_ROOT}/build)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment