Merge topic 'cygwin'

85c0a69 Cygwin: Do not define 'WIN32' (#10122)
62c6d2d Merge branch 'cmake_--system-information_min-version' into cygwin
72db20f Merge branch 'tests-if-CYGWIN' into cygwin
5adef16 Merge branch 'cygwin-module-prefix' into cygwin
cbc3258 Merge branch 'try-compile-min-version' into cygwin
This commit is contained in:
Brad King 2010-12-21 14:06:32 -05:00 committed by CMake Topic Stage
commit 9f46051490
3 changed files with 52 additions and 5 deletions

View File

@ -10,6 +10,7 @@
# See the License for more information. # See the License for more information.
#============================================================================= #=============================================================================
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5 FATAL_ERROR) 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) PROJECT(CMake)
IF(COMMAND CMAKE_POLICY) IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW) CMAKE_POLICY(SET CMP0003 NEW)

View File

@ -1,4 +1,48 @@
SET(WIN32 1) if("${CMAKE_MINIMUM_REQUIRED_VERSION}" VERSION_LESS "2.8.3.20101214")
set(__USE_CMAKE_LEGACY_CYGWIN_WIN32 1)
endif()
if(NOT DEFINED WIN32)
set(WIN32 0)
if(DEFINED __USE_CMAKE_LEGACY_CYGWIN_WIN32)
if(NOT DEFINED CMAKE_LEGACY_CYGWIN_WIN32
AND DEFINED ENV{CMAKE_LEGACY_CYGWIN_WIN32})
set(CMAKE_LEGACY_CYGWIN_WIN32 $ENV{CMAKE_LEGACY_CYGWIN_WIN32})
endif()
if(CMAKE_LEGACY_CYGWIN_WIN32)
message(STATUS "Defining WIN32 under Cygwin due to CMAKE_LEGACY_CYGWIN_WIN32")
set(WIN32 1)
elseif("x${CMAKE_LEGACY_CYGWIN_WIN32}" STREQUAL "x")
message(WARNING "CMake no longer defines WIN32 on Cygwin!"
"\n"
"(1) If you are just trying to build this project, ignore this warning "
"or quiet it by setting CMAKE_LEGACY_CYGWIN_WIN32=0 in your environment or "
"in the CMake cache. "
"If later configuration or build errors occur then this project may "
"have been written under the assumption that Cygwin is WIN32. "
"In that case, set CMAKE_LEGACY_CYGWIN_WIN32=1 instead."
"\n"
"(2) If you are developing this project, add the line\n"
" set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required\n"
"at the top of your top-level CMakeLists.txt file or set the minimum "
"required version of CMake to 2.8.4 or higher. "
"Then teach your project to build on Cygwin without WIN32.")
endif()
elseif(DEFINED CMAKE_LEGACY_CYGWIN_WIN32)
message(AUTHOR_WARNING "CMAKE_LEGACY_CYGWIN_WIN32 ignored because\n"
" cmake_minimum_required(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION})\n"
"is at least 2.8.4.")
endif()
endif()
if(DEFINED __USE_CMAKE_LEGACY_CYGWIN_WIN32)
# Pass WIN32 legacy setting to scripts.
if(WIN32)
set(ENV{CMAKE_LEGACY_CYGWIN_WIN32} 1)
else()
set(ENV{CMAKE_LEGACY_CYGWIN_WIN32} 0)
endif()
unset(__USE_CMAKE_LEGACY_CYGWIN_WIN32)
endif()
SET(CYGWIN 1) SET(CYGWIN 1)
SET(CMAKE_SHARED_LIBRARY_PREFIX "cyg") SET(CMAKE_SHARED_LIBRARY_PREFIX "cyg")

View File

@ -2341,17 +2341,19 @@ void cmMakefile::AddDefaultDefinitions()
working, these variables are still also set here in this place, but they working, these variables are still also set here in this place, but they
will be reset in CMakeSystemSpecificInformation.cmake before the platform will be reset in CMakeSystemSpecificInformation.cmake before the platform
files are executed. */ files are executed. */
#if defined(_WIN32) || defined(__CYGWIN__) #if defined(_WIN32)
this->AddDefinition("WIN32", "1"); this->AddDefinition("WIN32", "1");
this->AddDefinition("CMAKE_HOST_WIN32", "1"); this->AddDefinition("CMAKE_HOST_WIN32", "1");
#else #else
this->AddDefinition("UNIX", "1"); this->AddDefinition("UNIX", "1");
this->AddDefinition("CMAKE_HOST_UNIX", "1"); this->AddDefinition("CMAKE_HOST_UNIX", "1");
#endif #endif
// Cygwin is more like unix so enable the unix commands
#if defined(__CYGWIN__) #if defined(__CYGWIN__)
this->AddDefinition("UNIX", "1"); if(cmSystemTools::IsOn(cmSystemTools::GetEnv("CMAKE_LEGACY_CYGWIN_WIN32")))
this->AddDefinition("CMAKE_HOST_UNIX", "1"); {
this->AddDefinition("WIN32", "1");
this->AddDefinition("CMAKE_HOST_WIN32", "1");
}
#endif #endif
#if defined(__APPLE__) #if defined(__APPLE__)
this->AddDefinition("APPLE", "1"); this->AddDefinition("APPLE", "1");