From 2ae3c4cd7a4d5678f89f9e104571a934418ea265 Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Mon, 8 Jan 2024 08:45:17 +0100 Subject: Make mastodonpp support configurable --- CMakeLists.txt | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 68c3d28..a81928c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,12 +15,17 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # For Kate's LSP find_package(QT NAMES Qt5 REQUIRED COMPONENTS Widgets Concurrent) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Concurrent) -find_package(mastodonpp REQUIRED) +# Compile option for mastodonpp support +option(MASTODONPP_BUILD "Build a version with mastodonpp support" ON) + +if(MASTODONPP_BUILD) + find_package(mastodonpp REQUIRED) +endif() # Get Git commit hash, from http://xit0.org/2013/04/cmake-use-git-branch-and-commit-details-in-project/ # Get a human-readable name of the latest commit on the current branch execute_process( - COMMAND git log -1 --format=%(describe) + COMMAND git log -1 "--format=%(describe)" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_DESCRIBE_TEXT OUTPUT_STRIP_TRAILING_WHITESPACE @@ -75,8 +80,6 @@ set(PROJECT_SOURCES src/command_line.h src/net/instance.cpp src/net/instance.h - src/net/mastodon_instance.cpp - src/net/mastodon_instance.h src/activitypub/fields.h src/activitypub/apactivity.h src/activitypub/apactor.h @@ -96,6 +99,13 @@ set(PROJECT_SOURCES src/activitypub/apquestion.cpp ) +if(MASTODONPP_BUILD) + list(APPEND PROJECT_SOURCES + src/net/mastodon_instance.cpp + src/net/mastodon_instance.h + ) +endif() + if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) qt_add_executable(ActorViewer MANUAL_FINALIZATION @@ -119,6 +129,10 @@ else() endif() endif() +if(MASTODONPP_BUILD) + target_compile_definitions(ActorViewer PRIVATE MASTODONPP_BUILD) +endif() + configure_file(gen/git_version.h.in gen/git_version.h) target_include_directories(ActorViewer PRIVATE gen) -- cgit v1.2.3-54-g00ecf