Skip to content

Commit 90b8c3c

Browse files
eldruinrcsanchez97
authored andcommitted
allow custom bsoncxx and mongocxx library names (#649)
1 parent 22d6f93 commit 90b8c3c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/bsoncxx/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ option(BSONCXX_POLY_USE_SYSTEM_MNMLSTC "Obtain mnmlstc/core from system" OFF)
2424
option(BSONCXX_POLY_USE_BOOST "Use boost for stdx polyfills" OFF)
2525
option(BSONCXX_POLY_USE_STD "Use C++17 std library for stdx polyfills" OFF)
2626

27+
set(BSONCXX_OUTPUT_BASENAME "bsoncxx" CACHE STRING "Output bsoncxx library base name")
28+
2729
# Count how many polyfill options are true-ish
2830
set(BSONCXX_POLY_OPTIONS_SET 0)
2931
foreach (BSONCXX_POLY_OPTION ${BSONCXX_POLY_USE_MNMLSTC} ${BSONCXX_POLY_USE_STD_EXPERIMENTAL} ${BSONCXX_POLY_USE_BOOST} ${BSONCXX_POLY_USE_STD})
@@ -120,11 +122,11 @@ endif()
120122
include(BsoncxxUtil)
121123

122124
if(BSONCXX_BUILD_SHARED)
123-
bsoncxx_add_library(bsoncxx_shared "bsoncxx" SHARED)
125+
bsoncxx_add_library(bsoncxx_shared "${BSONCXX_OUTPUT_BASENAME}" SHARED)
124126
endif()
125127

126128
if(BSONCXX_BUILD_STATIC)
127-
bsoncxx_add_library(bsoncxx_static "bsoncxx-static" STATIC)
129+
bsoncxx_add_library(bsoncxx_static "${BSONCXX_OUTPUT_BASENAME}-static" STATIC)
128130
endif()
129131

130132
if(BSONCXX_BUILD_SHARED)

src/mongocxx/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ set(MONGOCXX_ABI_VERSION _noabi)
2121
option(MONGOCXX_ENABLE_SSL "Enable SSL - if the underlying C driver offers it" ON)
2222
option(MONGOCXX_ENABLE_SLOW_TESTS "Run slow tests when invoking the the test target" OFF)
2323

24+
set(MONGOCXX_OUTPUT_BASENAME "mongocxx" CACHE STRING "Output mongocxx library base name")
25+
2426
set(MONGOCXX_VERSION_NO_EXTRA ${MONGOCXX_VERSION_MAJOR}.${MONGOCXX_VERSION_MINOR}.${MONGOCXX_VERSION_PATCH})
2527
set(MONGOCXX_VERSION ${MONGOCXX_VERSION_NO_EXTRA}${MONGOCXX_VERSION_EXTRA})
2628
message ("mongocxx version: ${MONGOCXX_VERSION}")
@@ -138,12 +140,12 @@ include_directories(
138140
include(MongocxxUtil)
139141

140142
if(MONGOCXX_BUILD_SHARED)
141-
mongocxx_add_library(mongocxx_shared "mongocxx" SHARED)
143+
mongocxx_add_library(mongocxx_shared "${MONGOCXX_OUTPUT_BASENAME}" SHARED)
142144
target_link_libraries(mongocxx_shared PUBLIC bsoncxx_shared)
143145
endif()
144146

145147
if(MONGOCXX_BUILD_STATIC)
146-
mongocxx_add_library(mongocxx_static "mongocxx-static" STATIC)
148+
mongocxx_add_library(mongocxx_static "${MONGOCXX_OUTPUT_BASENAME}-static" STATIC)
147149
target_link_libraries(mongocxx_static PUBLIC bsoncxx_static)
148150
endif()
149151

0 commit comments

Comments
 (0)