[CMake] cmake for cygwin

Rolf Eike Beer eike at sf-mail.de
Fri Oct 22 09:12:34 EDT 2010


> --- Ven 22/10/10, Michael Wild  ha scritto:
>
>
>> >>
>> >> That's why one should check for CYGWIN in the
>> >> CMakeLists.txt files. IMHO this is a user-error
>> and not
>> >> CMake's fault. The doc clearly states about the
>> WIN32
>> >> variable:
>> >>
>> >>        WIN32  True on
>> windows
>> >> systems, including win64.
>> >
>> > But for cygwin is WRONG. It should be false
>>
>> One could also argue that cygwin is running under WIN32. A
>> matter of convention.
>
> Sorry again, but you are wrong.
> It is not a convention, Cygwin is a unix platform.
> Cygwin programs don't work as usual win32 programs

It is a convention, and it is documented in the CMake man page. If this
convention is different at other places this might be misleading, but
that's all.

>> > WIN32 in not defined when you compile for cygwin any
>> > package.
>> > It is defined if your target is non cygwin but a pure
>> > win32 program like mingw ones.
>> > Eg. Autoconf/Automake don't set WIN32.
>>
>> WIN32 is the super-set of pure Windows, CYGWIN and
>> MSYS/MINGW. And in case you haven't noticed: CMake is not a
>> Autoconf clone...
>
> This super-set is wrong. Cygwin belongs to Unix family

Exactly. And guess what: "IF (UNIX)" would also include Cygwin.

> I noticed. But Automake/autoconf makes it right, it
> doesn't mix cygwin with win32 programs.

Well, you did not ask right ;)

IF (UNIX)
  foo
ENDIF()

-> Cygwin would say foo

IF (WIN32)
 foo
ENDIF ()

-> Cygwin would say foo

IF (CYGWIN)
 foo
ENDIF ()

-> well, you guess it

So this is only different from what other build tools or whatever do. But
it is well known behaviour, it is documented, and it can't be changed for
backward compatibility anyway.

>> > Checking for CYGWIN in the CMakeLists.txt
>> > oblige to modify upstream source for any package
>> > we want to port on cygwin. While not setting WIN32
>> > allow to use upstream source without change and
>> building
>> > like any other Unix system.
>>
>> Not checking for CYGWIN is an error in the upstream package
>> and should be reported there or patched by you.
>
> This is absurd.
> The upstream could ignore CYGWIN, but I as package maintainer
> I should not patch every single package when NOT setting
> WIN32 allow me to build from the source of the shelf.

Ehm, if the upstream writes a CMakeLists.txt it should write a valid one.

> To build qhull (http://www.qhull.org/)
> I needed no cygwin specific patch, but only a cmake package
> with a RIGHT understanding of what Cygwin is: SET(WIN32 0)
>
> Also VTK builds as true cygwin programs with SET(WIN32 0)

Those are bugs, report them.

Eike


More information about the CMake mailing list