|
| 1 | +/* |
| 2 | +Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
| 3 | +
|
| 4 | +The MySQL Connector/C++ is licensed under the terms of the GPLv2 |
| 5 | +<http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most |
| 6 | +MySQL Connectors. There are special exceptions to the terms and |
| 7 | +conditions of the GPLv2 as it is applied to this software, see the |
| 8 | +FLOSS License Exception |
| 9 | +<http://www.mysql.com/about/legal/licensing/foss-exception.html>. |
| 10 | +
|
| 11 | +This program is free software; you can redistribute it and/or modify |
| 12 | +it under the terms of the GNU General Public License as published |
| 13 | +by the Free Software Foundation; version 2 of the License. |
| 14 | +
|
| 15 | +This program is distributed in the hope that it will be useful, but |
| 16 | +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 17 | +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 18 | +for more details. |
| 19 | +
|
| 20 | +You should have received a copy of the GNU General Public License along |
| 21 | +with this program; if not, write to the Free Software Foundation, Inc., |
| 22 | +51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 23 | +*/ |
| 24 | + |
| 25 | + |
| 26 | +#include <mysql.h> |
| 27 | +#include <stdio.h> |
| 28 | +#include <string.h> |
| 29 | + |
| 30 | +int main(int argc, char *argv[]) { |
| 31 | + FILE *fp; |
| 32 | + int i; |
| 33 | + |
| 34 | + if (argc < 3) { |
| 35 | + return 1; |
| 36 | + } |
| 37 | + |
| 38 | + if (!(fp = fopen(argv[1], "w"))) { |
| 39 | + return 1; |
| 40 | + } |
| 41 | + |
| 42 | + i = 2; |
| 43 | + while (i < argc) { |
| 44 | + if (strcmp(argv[i], "MYSQL_SERVER_VERSION") == 0) { |
| 45 | + fprintf(fp, "\nSET(MYSQL_CPP_SERVER_VERSION \"%s\")\n", MYSQL_SERVER_VERSION); |
| 46 | + } else if (strcmp(argv[i], "MYSQL_VERSION_ID") == 0) { |
| 47 | + fprintf(fp, "\nSET(MYSQL_CPP_SERVER_VERSION_ID %d)\n", MYSQL_VERSION_ID); |
| 48 | + } else if (strcmp(argv[i], "LIBMYSQL_VERSION") == 0) { |
| 49 | + fprintf(fp, "\nSET(LIBMYSQL_CPP_VERSION \"%s\")\n", LIBMYSQL_VERSION); |
| 50 | + } else if (strcmp(argv[i], "LIBMYSQL_VERSION_ID") == 0) { |
| 51 | + fprintf(fp, "\nSET(LIBMYSQL_CPP_VERSION_ID %d)\n", LIBMYSQL_VERSION_ID); |
| 52 | + } |
| 53 | + ++i; |
| 54 | + } |
| 55 | + |
| 56 | + fclose(fp); |
| 57 | + return 1; |
| 58 | +} |
0 commit comments