diff options
author | Brad King <brad.king@kitware.com> | 2010-12-17 19:19:58 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2010-12-17 19:19:58 (GMT) |
commit | 85c0a69a92e78275ea0b180482bafcdb877b0dc3 (patch) | |
tree | 95bae04e3854fa2c20dbc585f09b9a5aa993a952 /CMakeLists.txt | |
parent | 62c6d2d7e71c0607cd2891444d1b15ad536f7ada (diff) | |
download | CMake-85c0a69a92e78275ea0b180482bafcdb877b0dc3.zip CMake-85c0a69a92e78275ea0b180482bafcdb877b0dc3.tar.gz CMake-85c0a69a92e78275ea0b180482bafcdb877b0dc3.tar.bz2 |
Cygwin: Do not define 'WIN32' (#10122)
One of Cygwin's goals is to build projects using the POSIX API with no
Windows awareness. Many CMake-built projects have been written to test
for UNIX and WIN32 but not CYGWIN. The preferred behavior under Cygwin
in such projects is to take the UNIX path but not the WIN32 path.
Unfortunately this change is BACKWARDS INCOMPATIBLE for Cygwin-aware
CMake projects! Some projects that previously built under Cygwin and
are Cygwin-aware when they test for WIN32 may now behave differently.
Eventually these projects will need to be updated, but to help users
build them in the meantime we print a warning about the change in
behavior. Furthermore, one may set CMAKE_LEGACY_CYGWIN_WIN32 to request
old behavior during the transition.
Normally we avoid backwards incompatible changes, but we make an
exception in this case for a few reasons:
(1) This behavior is preferred by Cygwin's design goals.
(2) A warning provides a clear path forward for everyone who may see
incompatible behavior, and CMAKE_LEGACY_CYGWIN_WIN32 provides a
compatibility option. The warning and compatibility option both
disappear when the minimum required version of CMake in a project is
sufficiently new, so this issue will simply go away over time as
projects are updated to account for the change.
(3) The fixes required to update projects are fairly insignificant.
Furthermore, the Cygwin distribution has no releases itself so project
versions that predate said fixes tend to be difficult to build anyway.
(4) This change enables many CMake-built projects that did not
previously build under Cygwin to work out-of-the-box. From bug #10122:
"I have built over 120 different source packages with (my patched)
CMake, including most of KDE4, and have found that NOT defining
WIN32 on Cygwin is much more accurate." -- Yaakov Selkowitz
A fully compatible change would require patches on top of these project
releases for Cygwin even though they otherwise need not be aware of it.
(5) Yaakov has been maintaining a fork of CMake with this change for the
Cygwin Ports distribution. It works well in practice. By accepting the
change in upstream CMake we avoid confusion between the versions.
CMake itself builds without WIN32 defined on Cygwin. Simply disable
CMAKE_LEGACY_CYGWIN_WIN32 explicitly in our own CMakeLists.txt file.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 98bde02..4508e33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ # See the License for more information. #============================================================================= CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5 FATAL_ERROR) +SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required PROJECT(CMake) IF(COMMAND CMAKE_POLICY) CMAKE_POLICY(SET CMP0003 NEW) |