[CMake] Building with CMake on MinGW/MSYS

Florent Teichteil florent.teichteil at gmail.com
Fri Feb 19 07:00:44 EST 2010


Le 19/02/2010 12:09, Hendrik Sattler a écrit :
> Zitat von Florent Teichteil <florent.teichteil at gmail.com>:
>> 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.
> 
> The pre-processor symbol is called _WIN32, not WIN32 (not the leading
> underscore):
> http://predef.sourceforge.net/preos.html#sec24
> 
> HS
> 
> 

Is _WIN32 a standard macro or only defined by cmake? I'd like to know in
order to inform openjpeg's authors about it so that they can modify
their code at best in their mind.

Thanks
Florent


More information about the CMake mailing list