[CMake] Building with CMake on MinGW/MSYS

Florent Teichteil florent.teichteil at gmail.com
Fri Feb 19 04:20:44 EST 2010


Hi all,

I am trying to build the OpenJPEG library, that uses CMake to generate
Makefiles, on MSYS with MinGW's gcc compiler.

Some files of the library include system-dependent headers depending on
the host system:

#ifdef WIN32
#include <windows.h>
#else
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/times.h>
#endif /* WIN32 */

However, the compilation of these files fails because the variable
"WIN32" is (very strangely) not defined, so that gcc goes inside the
"#else" statement and does not find the headers under the "sys"
directory (which do not exist on windows). As I am compiling on a
windows platform on MSYS, shouldn't I expect the variable "WIN32" to be
defined? I tried the "MSYS" and "Unix" makefile generators, but none of
them works.

Thanks for your help,
Florent


More information about the CMake mailing list