Building MySQL on Windows

CMake

http://www.cmake.org/cmake/resources/software.html

$ ./configure --prefix=/mingw
$ make
$ make install

MySQL

http://dev.mysql.com/downloads/connector/c/

Download the noinstall zip file (e.g. mysql-connector-c-noinstall-6.0.2-win32.zip) and extract it into C:\Program Files\libmysql (so you should have C:\Program Files\libmysql\include, C:\Program Files\libmysql\lib etc.) It has to be in C:\Program Files\libmysql, because the mysql_config that goes with it has that path hardcoded.

OK, this is bullshit, we need to implement our own MySQL macros (or just use METNO_REQUIRE_LIB)

note, autoconf fails to compile mysql.h but puSQL builds just fine...

$ cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=/opt/mysql

http://dev.mysql.com/get/Downloads/MySQL-5.1/

Unfortunately, MySQL won't build on Windows with gcc, only with MSVC. However, the official build works fine: download the noinstall zip file (e.g. mysql-noinstall-5.1.43-win32.zip for 5.1.43) and extract it somewhere convenient.