diff --git a/Formula/mysql++.rb b/Formula/mysql++.rb index 64f93d3d8b..cb88c57780 100644 --- a/Formula/mysql++.rb +++ b/Formula/mysql++.rb @@ -13,15 +13,31 @@ class Mysqlxx < Formula sha256 "154e219e9cac151437d47b281ca35aa35eaf3d510b04f5e9886a0257a983a760" => :mountain_lion end - depends_on "mysql-connector-c" + depends_on :mysql def install + mysql_include_dir = `mysql_config --variable=pkgincludedir` system "./configure", "--disable-debug", "--disable-dependency-tracking", "--prefix=#{prefix}", "--with-field-limit=40", "--with-mysql-lib=#{HOMEBREW_PREFIX}/lib", - "--with-mysql-include=#{HOMEBREW_PREFIX}/include" + "--with-mysql-include=#{mysql_include_dir}" system "make", "install" end + + test do + (testpath/"test.cpp").write <<-EOS.undent + #include + int main(int argc, char *argv[]) { + mysqlpp::examples::CommandLine cmdline(argc, argv); + if (!cmdline) { + return 1; + } + return 0; + } + EOS + system ENV.cxx, "test.cpp", `mysql_config --include`.chomp, "-L#{lib}", "-lmysqlpp", "-o", "test" + system "./test", "-u", "foo", "-p", "bar" + end end