From a429e4b9b1a56470c6c119a077910d2f090c21d0 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 19 Jan 2023 14:29:35 -0500 Subject: CYGWIN: Drop pre-2.8.4 compatibility mode CMAKE_LEGACY_CYGWIN_WIN32 Prior to CMake 2.8.4 (released in 2011), we defined `WIN32` on CYGWIN. That was removed, but an undocumented `CMAKE_LEGACY_CYGWIN_WIN32` compatibility mode was left to help projects transition. Only projects that do not require at least 2.8.4 as their minimum CMake version need the compatibility mode. We've also long warned about projects that do not require at least 2.8.12, so it is now reasonable to remove the legacy compatibility mode. --- Help/release/dev/cygwin-no-legacy-win32.rst | 5 ++++ Modules/Platform/CYGWIN.cmake | 45 ----------------------------- Source/CPack/cpack.cxx | 3 -- Source/CTest/cmCTestScriptHandler.cxx | 4 --- Source/cmStateSnapshot.cxx | 8 ----- 5 files changed, 5 insertions(+), 60 deletions(-) create mode 100644 Help/release/dev/cygwin-no-legacy-win32.rst diff --git a/Help/release/dev/cygwin-no-legacy-win32.rst b/Help/release/dev/cygwin-no-legacy-win32.rst new file mode 100644 index 0000000..7991138 --- /dev/null +++ b/Help/release/dev/cygwin-no-legacy-win32.rst @@ -0,0 +1,5 @@ +cygwin-no-legacy-win32 +---------------------- + +* On CYGWIN, the undocumented ``CMAKE_LEGACY_CYGWIN_WIN32`` mode for + compatibility with CMake versions older than 2.8.4 has been removed. diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake index fc4ea2e..0b64496 100644 --- a/Modules/Platform/CYGWIN.cmake +++ b/Modules/Platform/CYGWIN.cmake @@ -1,48 +1,3 @@ -if("${CMAKE_MINIMUM_REQUIRED_VERSION}" VERSION_LESS "2.8.3.20101214" AND NOT MSYS) - set(__USE_CMAKE_LEGACY_CYGWIN_WIN32 1) -endif() -if(NOT DEFINED WIN32 AND NOT MSYS) - 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(CMAKE_SHARED_LIBRARY_PREFIX "cyg") diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index c228f07..2257118 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -233,9 +233,6 @@ int main(int argc, char const* const* argv) cminst.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator cmgg(&cminst); cmMakefile globalMF(&cmgg, cminst.GetCurrentSnapshot()); -#if defined(__CYGWIN__) - globalMF.AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0"); -#endif bool parsed = true; for (std::size_t i = 0; i < inputArgs.size(); i++) { diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 5a66f82..ee06b29 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -326,10 +326,6 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) this->Makefile->AddDefinition("CTEST_SCRIPT_ARG", script_arg); } -#if defined(__CYGWIN__) - this->Makefile->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0"); -#endif - // set a callback function to update the elapsed time this->Makefile->OnExecuteCommand([this] { this->UpdateElapsedTime(); }); diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index cb5f11f..e230702 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -301,14 +301,6 @@ void cmStateSnapshot::SetDefaultDefinitions() this->SetDefinition("UNIX", "1"); this->SetDefinition("CMAKE_HOST_UNIX", "1"); } -#if defined(__CYGWIN__) - std::string legacy; - if (cmSystemTools::GetEnv("CMAKE_LEGACY_CYGWIN_WIN32", legacy) && - cmIsOn(legacy)) { - this->SetDefinition("WIN32", "1"); - this->SetDefinition("CMAKE_HOST_WIN32", "1"); - } -#endif #if defined(__APPLE__) this->SetDefinition("APPLE", "1"); this->SetDefinition("CMAKE_HOST_APPLE", "1"); -- cgit v0.12