diff --git a/Formula/mysql-connector-c++.rb b/Formula/mysql-connector-c++.rb index 9dc2080e4a..1fab040cf5 100644 --- a/Formula/mysql-connector-c++.rb +++ b/Formula/mysql-connector-c++.rb @@ -1,9 +1,3 @@ -class MysqlClientRequirement < Requirement - fatal true - default_formula "mysql" - satisfy { which "mysql" } -end - class MysqlConnectorCxx < Formula desc "MySQL database connector for C++ applications" homepage "https://dev.mysql.com/downloads/connector/cpp/" @@ -22,10 +16,26 @@ class MysqlConnectorCxx < Formula depends_on "cmake" => :build depends_on "boost" => :build depends_on "openssl" - depends_on MysqlClientRequirement + depends_on :mysql def install system "cmake", ".", *std_cmake_args system "make", "install" end + + test do + (testpath/"test.cpp").write <<-EOS.undent + #include + int main(void) { + try { + sql::Driver *driver = get_driver_instance(); + } catch (sql::SQLException &e) { + return 1; + } + return 0; + } + EOS + system ENV.cxx, "test.cpp", `mysql_config --include`.chomp, "-L#{lib}", "-lmysqlcppconn", "-o", "test" + system "./test" + end end