File tree Expand file tree Collapse file tree 3 files changed +21
-12
lines changed Expand file tree Collapse file tree 3 files changed +21
-12
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,11 @@ set(CMAKE_CXX_EXTENSIONS OFF)
6161include (GenerateExportHeader)
6262include (InstallRequiredSystemLibraries)
6363
64+ # Allow the user to decie whether to install the shared libaries. Note that we always build them,
65+ # since otherwise it makes the CMake logic very complex, but setting BUILD_SHARED_LIBS=Off will at
66+ # least disable installing them.
67+ option (BUILD_SHARED_LIBS "Install shared libraries" ON )
68+
6469# If the user did not customize the install prefix,
6570# set it to live under build so we don't inadverently pollute /usr/local
6671if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
Original file line number Diff line number Diff line change @@ -170,12 +170,14 @@ install(FILES
170170 COMPONENT dev
171171)
172172
173- install (TARGETS
174- bsoncxx
175- RUNTIME DESTINATION bin COMPONENT runtime
176- LIBRARY DESTINATION lib COMPONENT runtime
177- ARCHIVE DESTINATION lib COMPONENT dev
178- )
173+ if (BUILD_SHARED_LIBS )
174+ install (TARGETS
175+ bsoncxx
176+ RUNTIME DESTINATION bin COMPONENT runtime
177+ LIBRARY DESTINATION lib COMPONENT runtime
178+ ARCHIVE DESTINATION lib COMPONENT dev
179+ )
180+ endif ()
179181
180182install (TARGETS
181183 bsoncxx_static
Original file line number Diff line number Diff line change @@ -178,12 +178,14 @@ install(FILES
178178 COMPONENT dev
179179)
180180
181- install (TARGETS
182- mongocxx
183- RUNTIME DESTINATION bin COMPONENT runtime
184- LIBRARY DESTINATION lib COMPONENT runtime
185- ARCHIVE DESTINATION lib COMPONENT dev
186- )
181+ if (BUILD_SHARED_LIBS )
182+ install (TARGETS
183+ mongocxx
184+ RUNTIME DESTINATION bin COMPONENT runtime
185+ LIBRARY DESTINATION lib COMPONENT runtime
186+ ARCHIVE DESTINATION lib COMPONENT dev
187+ )
188+ endif ()
187189
188190install (TARGETS
189191 mongocxx_static
You can’t perform that action at this time.
0 commit comments