From 8ecbdd2f73b344e2611929622be330d0f32901cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Walenciak?= Date: Thu, 30 Apr 2026 21:49:30 +0200 Subject: [PATCH] Add flag for library type control --- CMakeLists.txt | 1 + src/CMakeLists.txt | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a7580f3..2f297a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ option(CppRestAPI_JsonPagination "JSON-aware Link-header pagination strategy (re option(CppRestAPI_GitHub "GitHub API helpers (ConnectionBuilder, Request). Implies CppRestAPI_JsonPagination." ON) option(CppRestAPI_Tests "Enable CppRestAPI tests. Forces all backends to be ON" OFF) option(CppRestAPI_Examples "Build CppRestAPI examples. Forces all backends to be ON" OFF) +option(CppRestAPI_BuildShared "Build CppRestAPI as shared library if ON" ${CMAKE_SHARED_LIBS}) if(CppRestAPI_Tests OR CppRestAPI_Examples) set(CppRestAPI_QtBackend ON) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7cef125..4f01728 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,7 +9,11 @@ configure_file( @ONLY ) -add_library(cpp_restapi version.cpp) +if(CppRestAPI_BuildShared) + add_library(cpp_restapi SHARED) +else() + add_library(cpp_restapi STATIC) +endif() target_include_directories(cpp_restapi PUBLIC @@ -32,6 +36,7 @@ target_sources(cpp_restapi PRIVATE header_utils.cpp threaded_connection.cpp sse_parser.cpp + version.cpp ) if(CppRestAPI_QtBackend)