class Cpprestsdk < Formula desc "C++ libraries for cloud-based client-server communication" homepage "https://github.com/Microsoft/cpprestsdk" # pull from git tag to get submodules url "https://github.com/Microsoft/cpprestsdk.git", :tag => "v2.10.8", :revision => "204a52610234ac5180e80a6883b62c0ad085f51e" head "https://github.com/Microsoft/cpprestsdk.git", :branch => "development" bottle do cellar :any sha256 "8e324363564023e408419aa863e195dbf53b9d13631e18861e8953016b0e9763" => :mojave sha256 "9948512053df55dbad7d8c19a011e111da9f5068ac482fc6c3abc2d3e78afbc1" => :high_sierra sha256 "778ad062735d15707e11a3a7a0c6628d7d948fead333100be5c6ad9c13ce7456" => :sierra 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