Commit ddcd1469 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Brad King
Browse files

MSYS: Add support for running under MSYS runtime environment

Detect MSYS as CYGWIN, with the required adaptations.
parent b3ca4f9a
......@@ -27,6 +27,7 @@
# Tru64 Tru64
# Ultrix ULTRIX
# cygwin CYGWIN_NT-5.1
# MSYS MSYS_NT-6.1
# MacOSX Darwin
......@@ -43,7 +44,7 @@ if(CMAKE_HOST_UNIX)
else()
exec_program(${CMAKE_UNAME} ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION)
endif()
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*|^GNU$|Android")
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*|MSYS.*|^GNU$|Android")
exec_program(${CMAKE_UNAME} ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
RETURN_VALUE val)
elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin")
......
......@@ -5,6 +5,9 @@
#if defined(__linux) || defined(__linux__) || defined(linux)
# define PLATFORM_ID "Linux"
#elif defined(__MSYS__)
# define PLATFORM_ID "MSYS"
#elif defined(__CYGWIN__)
# define PLATFORM_ID "Cygwin"
......
......@@ -14,6 +14,7 @@
set(APPLE )
set(UNIX )
set(CYGWIN )
set(MSYS )
set(WIN32 )
......
......@@ -225,7 +225,7 @@ if(CMAKE_USE_PTHREADS_INIT)
set(CMAKE_THREAD_LIBS_INIT )
endif()
if(CMAKE_SYSTEM MATCHES "CYGWIN_NT")
if(CMAKE_SYSTEM MATCHES "CYGWIN_NT" OR CMAKE_SYSTEM MATCHES "MSYS_NT")
set(CMAKE_USE_PTHREADS_INIT 1)
set(Threads_FOUND TRUE)
set(CMAKE_THREAD_LIBS_INIT )
......
if("${CMAKE_MINIMUM_REQUIRED_VERSION}" VERSION_LESS "2.8.3.20101214")
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)
if(NOT DEFINED WIN32 AND NOT MSYS)
set(WIN32 0)
if(DEFINED __USE_CMAKE_LEGACY_CYGWIN_WIN32)
if(NOT DEFINED CMAKE_LEGACY_CYGWIN_WIN32
......
include(Platform/CYGWIN-Clang-C)
include(Platform/CYGWIN-Clang-CXX)
include(Platform/CYGWIN-Determine-CXX)
include(Platform/CYGWIN-GNU-C)
include(Platform/CYGWIN-GNU-CXX)
include(Platform/CYGWIN-GNU-Fortran)
include(Platform/CYGWIN-GNU)
include(Platform/CYGWIN-windres)
set(MSYS 1)
include(Platform/CYGWIN)
set(CMAKE_SHARED_LIBRARY_PREFIX "msys-")
set(CMAKE_SHARED_MODULE_PREFIX "msys-")
......@@ -44,7 +44,7 @@ endif()
if(NOT CMake_DEFAULT_RECURSION_LIMIT)
if(DEFINED ENV{DASHBOARD_TEST_FROM_CTEST})
set(CMake_DEFAULT_RECURSION_LIMIT 100)
elseif(MINGW)
elseif(MINGW OR MSYS)
set(CMake_DEFAULT_RECURSION_LIMIT 400)
elseif(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM")
set(CMake_DEFAULT_RECURSION_LIMIT 600)
......
......@@ -80,7 +80,9 @@ if(CMake_HAVE_CXX_MAKE_UNIQUE)
set(CMake_HAVE_CXX_UNIQUE_PTR 1)
endif()
cm_check_cxx_feature(unique_ptr)
if (NOT CMAKE_CXX_STANDARD LESS "17")
if (NOT CMAKE_CXX_STANDARD LESS "17"
AND NOT MSYS # FIXME: RunCMake.cmake_path cases crash with MSYS std::filesystem
)
if (NOT CMAKE_CROSSCOMPILING OR CMAKE_CROSSCOMPILING_EMULATOR)
cm_check_cxx_feature(filesystem TRY_RUN)
else()
......
......@@ -40,7 +40,14 @@ They may be set by end users to point at LibUUID components.
#]=======================================================================]
#-----------------------------------------------------------------------------
if(CYGWIN)
if(MSYS)
# Note: on current version of MSYS2, linking to libuuid.dll.a doesn't
# import the right symbols sometimes. Fix this by linking directly
# to the DLL that provides the symbols, instead.
find_library(LibUUID_LIBRARY
NAMES msys-uuid-1.dll
)
elseif(CYGWIN)
# Note: on current version of Cygwin, linking to libuuid.dll.a doesn't
# import the right symbols sometimes. Fix this by linking directly
# to the DLL that provides the symbols, instead.
......
......@@ -655,7 +655,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
xml.EndElement(); // extension
} else {
std::string systemName = mf->GetSafeDefinition("CMAKE_SYSTEM_NAME");
if (systemName == "CYGWIN") {
if (systemName == "CYGWIN" || systemName == "MSYS") {
xml.StartElement("extension");
xml.Attribute("id", "org.eclipse.cdt.core.Cygwin_PE");
xml.Attribute("point", "org.eclipse.cdt.core.BinaryParser");
......
......@@ -3239,10 +3239,14 @@ cm::string_view cmSystemTools::GetSystemName()
systemName = "kFreeBSD";
}
// fix for CYGWIN which has windows version in it
// fix for CYGWIN and MSYS which have windows version in them
if (systemName.find("CYGWIN") != cm::string_view::npos) {
systemName = "CYGWIN";
}
if (systemName.find("MSYS") != cm::string_view::npos) {
systemName = "MSYS";
}
return systemName;
}
return "";
......
......@@ -460,7 +460,7 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(OutName exe.OutName.exe)
ADD_TEST_MACRO(ObjectLibrary UseCshared)
ADD_TEST_MACRO(NewlineArgs NewlineArgs)
ADD_TEST_MACRO(SetLang SetLang)
ADD_TEST_MACRO(SetLang SetLangX)
ADD_TEST_MACRO(EmptyProperty EmptyProperty)
ADD_TEST_MACRO(ExternalOBJ ExternalOBJ)
if(NOT CMake_TEST_EXTERNAL_CMAKE)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment