Join us Sept 17 at .local NYC! Use code WEB50 to save 50% on tickets. Learn more >
MongoDB Event
Docs Menu
Docs Home
/ / /
C++ 드라이버
/

macOS에 설치

먼저 에서 C++17 폴리필 라이브러리를 선택합니다.

mongocxx 드라이버를 빌드하기 위한 가장 안정적인 시작점은 최신 릴리스 tarball입니다.

The mongocxx releases page will have links to the release tarball for the version you wish you install. For example, to download version 3.10.1:

curl -OL https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.10.1/mongo-cxx-driver-r3.10.1.tar.gz
tar -xzf mongo-cxx-driver-r3.10.1.tar.gz
cd mongo-cxx-driver-r3.10.1/build

얻은 소스 트리의 build 디렉토리로 변경해야 합니다.

추가 구성 없이 mongocxx 는 소스에서 빌드하는 사용자를 위한 편의의 일환으로 로컬 빌드 디렉토리에 설치됩니다. /usr/local 에도 설치할 수 있도록 mongocxx 를 구성하려면 다음 cmake 명령을 사용합니다.

cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DMONGOCXX_OVERRIDE_DEFAULT_INSTALL_PREFIX=OFF

이러한 옵션은 C++17 폴리필 옵션과 자유롭게 혼합할 수 있습니다. 예를 들어, 사용자가 폴리필 부스트 옵션을 사용하여 위의 명령을 실행하는 방법은 다음과 같습니다.

cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DBSONCXX_POLY_USE_BOOST=1 \
-DMONGOCXX_OVERRIDE_DEFAULT_INSTALL_PREFIX=OFF

드라이버를 빌드하고 설치합니다.

cmake --build .
sudo cmake --build . --target install

드라이버는 나중에 두 가지 방법 중 하나로 제거할 수 있습니다. 먼저 제거 대상을 호출할 수 있습니다.

sudo cmake --build . --target uninstall

둘째, 제거 스크립트를 호출할 수 있습니다.

sudo <install-dir>/share/mongo-cxx-driver/uninstall.sh

돌아가기

Windows

이 페이지의 내용