class Cpprestsdk < Formula desc "C++ libraries for cloud-based client-server communication" homepage "https://github.com/Microsoft/cpprestsdk" url "https://github.com/Microsoft/cpprestsdk/archive/v2.10.2.tar.gz" sha256 "fb0b611007732d8de9528bc37bd67468e7ef371672f89c88f225f73cdc4ffcf1" head "https://github.com/Microsoft/cpprestsdk.git", :branch => "development" bottle do cellar :any sha256 "7a07bbeb8e65fcea88390712f7c5f2e3e39dcf8752727dbd410c5f464cd967a9" => :mojave sha256 "d14bed2a2b49d91649d9fc8aa9708b1dc37b3c5b2b8bffcbdda79c2df8542319" => :high_sierra sha256 "f72554353c248a4f479be76e8382fef549c9abb2690445adb6bcb49d8f867bd1" => :sierra sha256 "53b4cdfd9b0b964a1803920d02ae066a4ddb2be58e68477d34906ba44048e52a" => :el_capitan end depends_on "cmake" => :build depends_on "boost" depends_on "openssl" def install system "cmake", "-DBUILD_SAMPLES=OFF", "-DBUILD_TESTS=OFF", "Release", *std_cmake_args system "make", "install" end test do (testpath/"test.cc").write <<~EOS #include #include int main() { web::http::client::http_client client(U("https://github.com/")); std::cout << client.request(web::http::methods::GET).get().extract_string().get() << std::endl; } EOS flags = ["-stdlib=libc++", "-std=c++11", "-I#{include}", "-I#{Formula["boost"].include}", "-I#{Formula["openssl"].include}", "-L#{lib}", "-L#{Formula["openssl"].lib}", "-L#{Formula["boost"].lib}", "-lssl", "-lcrypto", "-lboost_random", "-lboost_chrono", "-lboost_thread-mt", "-lboost_system-mt", "-lboost_regex", "-lboost_filesystem", "-lcpprest"] + ENV.cflags.to_s.split system ENV.cxx, "-o", "test_cpprest", "test.cc", *flags system "./test_cpprest" end end