aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt46
1 files changed, 30 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 49105389..bae833c3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,6 @@
-cmake_minimum_required(VERSION 3.10)
+# Officially CMake 3.16+ is needed but LGTM.com still sits on eoan that only
+# has CMake 3.13
+cmake_minimum_required(VERSION 3.13)
if (POLICY CMP0092)
cmake_policy(SET CMP0092 NEW)
endif()
@@ -140,6 +142,8 @@ list(APPEND lib_SRCS
lib/util.cpp
lib/encryptionmanager.cpp
lib/eventitem.cpp
+ lib/accountregistry.cpp
+ lib/mxcreply.cpp
lib/events/event.cpp
lib/events/roomevent.cpp
lib/events/stateevent.cpp
@@ -176,7 +180,7 @@ set(ASAPI_DEF_DIR application-service/definitions)
set(ISAPI_DEF_DIR identity/definitions)
if (GTAD_PATH AND MATRIX_DOC_PATH)
- get_filename_component(ABS_GTAD_PATH "${GTAD_PATH}" REALPATH)
+ get_filename_component(ABS_GTAD_PATH "${GTAD_PATH}" PROGRAM PROGRAM_ARGS GTAD_ARGS)
if (EXISTS ${ABS_GTAD_PATH})
get_filename_component(ABS_API_DEF_PATH "${MATRIX_DOC_PATH}/data/api" REALPATH)
if (NOT IS_DIRECTORY ${ABS_API_DEF_PATH})
@@ -198,7 +202,7 @@ if (API_GENERATION_ENABLED)
if (NOT CLANG_FORMAT)
set(CLANG_FORMAT clang-format)
endif()
- get_filename_component(ABS_CLANG_FORMAT "${CLANG_FORMAT}" PROGRAM)
+ get_filename_component(ABS_CLANG_FORMAT "${CLANG_FORMAT}" PROGRAM PROGRAM_ARGS CLANG_FORMAT_ARGS)
if (ABS_CLANG_FORMAT)
set(API_FORMATTING_ENABLED 1)
message( STATUS "clang-format is at ${ABS_CLANG_FORMAT}")
@@ -206,15 +210,14 @@ if (API_GENERATION_ENABLED)
message( STATUS "${CLANG_FORMAT} is NOT FOUND; API files won't be reformatted")
endif ()
- if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.12.0")
- # We use globbing with CONFIGURE_DEPENDS to produce two file lists:
- # one of all API files for clang-format and another of just .cpp
- # files to supply for library source files. Since we expect these
- # file lists to only change due to GTAD invocation, we only use
- # CONFIGURE_DEPENDS when pre-requisites to update API are met.
- # Read comments next to each file(GLOB_RECURSE) for caveats.
- set(add_CONFIGURE_DEPENDS "CONFIGURE_DEPENDS")
- endif()
+ # We use globbing with CONFIGURE_DEPENDS to produce two file lists:
+ # one of all API files for clang-format and another of just .cpp
+ # files to supply for library source files. Since we expect these
+ # file lists to only change due to GTAD invocation, we only use
+ # CONFIGURE_DEPENDS when pre-requisites to update API are met.
+ # Read comments next to each file(GLOB_RECURSE) for caveats.
+ set(add_CONFIGURE_DEPENDS "CONFIGURE_DEPENDS")
+
set(FULL_CSAPI_SRC_DIR ${ABS_API_DEF_PATH}/client-server)
file(GLOB_RECURSE API_DEFS RELATIVE ${PROJECT_SOURCE_DIR}
${FULL_CSAPI_SRC_DIR}/*.yaml
@@ -227,6 +230,7 @@ if (API_GENERATION_ENABLED)
old_sync.yaml- room_initial_sync.yaml- # deprecated
key_backup.yaml- # immature and buggy in terms of API definition
sync.yaml- # we have a better handcrafted implementation
+ ${GTAD_ARGS}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/lib
SOURCES gtad/gtad.yaml
gtad/data.h.mustache
@@ -274,14 +278,16 @@ file(GLOB_RECURSE api_SRCS ${add_CONFIGURE_DEPENDS} ${FULL_CSAPI_DIR}/*.cpp)
add_library(${PROJECT_NAME} ${lib_SRCS} ${api_SRCS})
target_compile_definitions(${PROJECT_NAME} PRIVATE QT_NO_JAVA_STYLE_ITERATORS QT_NO_URL_CAST_FROM_STRING QT_NO_CAST_TO_ASCII)
-if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.16.0"
- AND NOT CMAKE_CXX_COMPILER_ID STREQUAL GNU) # https://bugzilla.redhat.com/show_bug.cgi?id=1721553
- target_precompile_headers(${PROJECT_NAME} PRIVATE lib/converters.h)
-endif ()
+
+target_compile_definitions(${PROJECT_NAME} PUBLIC ${PROJECT_NAME}_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}
+ ${PROJECT_NAME}_VERSION_MINOR=${PROJECT_VERSION_MINOR} ${PROJECT_NAME}_VERSION_PATCH=${PROJECT_VERSION_PATCH}
+ ${PROJECT_NAME}_VERSION_STRING=\"${PROJECT_VERSION}\")
if (${PROJECT_NAME}_ENABLE_E2EE)
target_compile_definitions(${PROJECT_NAME} PUBLIC ${PROJECT_NAME}_E2EE_ENABLED)
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES
+ CXX_STANDARD 20
+ CXX_EXTENSIONS OFF
VERSION "${PROJECT_VERSION}"
SOVERSION ${API_VERSION}
INTERFACE_${PROJECT_NAME}_MAJOR_VERSION ${API_VERSION}
@@ -289,8 +295,16 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY
COMPATIBLE_INTERFACE_STRING ${PROJECT_NAME}_MAJOR_VERSION)
+# C++17 required, C++20 desired (see above)
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17)
+# TODO: Bump the CMake requirement and drop the version check here once
+# LGTM upgrades
+if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.16.0"
+ AND NOT CMAKE_CXX_COMPILER_ID STREQUAL GNU) # https://bugzilla.redhat.com/show_bug.cgi?id=1721553
+ target_precompile_headers(${PROJECT_NAME} PRIVATE lib/converters.h)
+endif ()
+
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib>
$<INSTALL_INTERFACE:${${PROJECT_NAME}_INSTALL_INCLUDEDIR}>