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)