class MongoCxxDriver < Formula desc "C++ driver for MongoDB" homepage "https://github.com/mongodb/mongo-cxx-driver" url "https://github.com/mongodb/mongo-cxx-driver/archive/r3.1.0.tar.gz" sha256 "6a55cae8e6fc296e0901b1f0b04ab7b10bb188ebb854ba39416086e8b152e520" head "https://github.com/mongodb/mongo-cxx-driver.git" bottle do sha256 "4d8aa7f22154b06f4b95de42ba61061ca444363ed88720e194dc8d5da5bab62b" => :sierra sha256 "815ed7f883fc4fa95d502adc669acf26ac20a202f8e1c6346829e6e2ba75c7ca" => :el_capitan sha256 "5b7a376c6e2b1b61a252b0ea727c6bc88fcaf950a9d7c12f66c941de5baa34c0" => :yosemite end needs :cxx11 depends_on "cmake" => :build depends_on "mongo-c-driver" def install mongo_c_prefix = Formula["mongo-c-driver"].opt_prefix system "cmake", ".", *std_cmake_args, "-DLIBBSON_DIR=#{mongo_c_prefix}", "-DLIBMONGOC_DIR=#{mongo_c_prefix}" system "make" system "make", "install" pkgshare.install "examples" end test do mongo_c_include = Formula["mongo-c-driver"] system ENV.cc, "-o", "test", pkgshare/"examples/bsoncxx/builder_basic.cpp", "-I#{include}/bsoncxx/v_noabi", "-I#{mongo_c_include}/libbson-1.0", "-L#{lib}", "-lbsoncxx", "-std=c++11", "-lstdc++" system "./test" system ENV.cc, "-o", "test", pkgshare/"examples/mongocxx/connect.cpp", "-I#{include}/mongocxx/v_noabi", "-I#{include}/bsoncxx/v_noabi", "-I#{mongo_c_include}/libmongoc-1.0", "-I#{mongo_c_include}/libbson-1.0", "-L#{lib}", "-lmongocxx", "-lbsoncxx", "-std=c++11", "-lstdc++" assert_match "No suitable servers", shell_output("./test mongodb://0.0.0.0 2>&1", 1) end end