@@ -72,8 +72,6 @@ if (${NEED_DOWNLOAD_C_DRIVER})
7272 include (FetchContent)
7373 include (ExternalProject)
7474
75- set (ENABLE_UNINSTALL OFF )
76-
7775 # Declare mongo-c-driver as a dependency
7876 FetchContent_Declare(
7977 mongo-c-driver
@@ -142,7 +140,7 @@ option(BUILD_SHARED_LIBS_WITH_STATIC_MONGOC
142140 OFF
143141)
144142
145- option (ENABLE_UNINSTALL "Enable creation of uninstall script and associated uninstall build target." OFF )
143+ option (ENABLE_UNINSTALL "Enable creation of uninstall script and associated uninstall build target." ON )
146144
147145# Allow the user to enable code coverage
148146option (ENABLE_CODE_COVERAGE "Enable code coverage." OFF )
@@ -411,20 +409,20 @@ if(NOT (TARGET bson_shared OR TARGET mongoc_shared))
411409 )
412410endif ()
413411
414- # if(ENABLE_UNINSTALL AND NOT (TARGET bson_shared OR TARGET mongoc_shared))
415- # if(WIN32)
416- # set(UNINSTALL_PROG "uninstall.cmd")
417- # else()
418- # set(UNINSTALL_PROG "uninstall.sh")
419- # endif()
420- # set(UNINSTALL_PROG_DIR "${CMAKE_INSTALL_DATADIR}/mongo-cxx-driver")
421- #
422- # # Create uninstall program and associated uninstall target
423- # #
424- # # This needs to be last (after all other add_subdirectory calls) to ensure
425- # # that the generated uninstall program is complete and correct
426- # add_subdirectory(generate_uninstall)
427- # endif()
412+ if (ENABLE_UNINSTALL AND NOT (TARGET bson_shared OR TARGET mongoc_shared))
413+ if (WIN32 )
414+ set (UNINSTALL_PROG "uninstall.cmd" )
415+ else ()
416+ set (UNINSTALL_PROG "uninstall.sh" )
417+ endif ()
418+ set (UNINSTALL_PROG_DIR "${CMAKE_INSTALL_DATADIR} /mongo-cxx-driver" )
419+
420+ # Create uninstall program and associated uninstall target
421+ #
422+ # This needs to be last (after all other add_subdirectory calls) to ensure
423+ # that the generated uninstall program is complete and correct
424+ add_subdirectory (generate_uninstall)
425+ endif ()
428426
429427# Spit out some information regarding the generated build system
430428message (STATUS "Build files generated for:" )
0 commit comments