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.2.tar.gz" sha256 "17915b68e094dd028d8ab4753d57cedf5ebd9ba9d98a9e87b7b0f27904e21e40" head "https://github.com/mongodb/mongo-cxx-driver.git" bottle do sha256 "fd1ce6c023cbcf6859cb41f845ed45a42a1465de95339a6ad6effaa163754afa" => :sierra sha256 "1c7be629080d9a85b25d76602617365d9a78f9442006b3e755aa1917a56411c2" => :el_capitan sha256 "73d48c0bf767e929063400988525d21d551cd85c04a6e64cb96be91042bb8cf4" => :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