diff --git a/src/bsoncxx/CMakeLists.txt b/src/bsoncxx/CMakeLists.txt index a9a7ada..6b87a6d 100644 --- a/src/bsoncxx/CMakeLists.txt +++ b/src/bsoncxx/CMakeLists.txt @@ -117,9 +117,15 @@ if (WIN32) ) endif() -add_library(bsoncxx SHARED - ${bsoncxx_sources} -) +if(BUILD_SHARED_LIBS) + add_library(bsoncxx SHARED + ${bsoncxx_sources} + ) +else() + add_library(bsoncxx SHARED + exception/error_code.cpp + ) +endif() set(bsoncxx_libs ${LIBBSON_LIBRARIES}) diff --git a/src/mongocxx/CMakeLists.txt b/src/mongocxx/CMakeLists.txt index 2ef54e4..53a13f7 100644 --- a/src/mongocxx/CMakeLists.txt +++ b/src/mongocxx/CMakeLists.txt @@ -134,9 +134,15 @@ set_target_properties(mongocxx_mocked PROPERTIES VERSION ${MONGOCXX_VERSION} ) -add_library(mongocxx SHARED - ${mongocxx_sources} -) +if(BUILD_SHARED_LIBS) + add_library(mongocxx SHARED + ${mongocxx_sources} + ) +else() + add_library(mongocxx SHARED + exception/error_code.cpp + ) +endif() set_target_properties (mongocxx PROPERTIES OUTPUT_NAME mongocxx