diff options
author | Orgad Shaneh <orgads@gmail.com> | 2021-04-01 17:03:52 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-04-26 18:27:34 (GMT) |
commit | ddcd1469e8377fe258913a20aa47e65f71f8695b (patch) | |
tree | d18b6561383a8f4bc206dac848a15814b74ca642 | |
parent | b3ca4f9ad18220b2f56cd6af7df5cf1e671d39a8 (diff) | |
download | CMake-ddcd1469e8377fe258913a20aa47e65f71f8695b.zip CMake-ddcd1469e8377fe258913a20aa47e65f71f8695b.tar.gz CMake-ddcd1469e8377fe258913a20aa47e65f71f8695b.tar.bz2 |
MSYS: Add support for running under MSYS runtime environment
Detect MSYS as CYGWIN, with the required adaptations.
60 files changed, 246 insertions, 66 deletions
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index c3f2b74..8c7af06 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -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") diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index 2643874..59195f8 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -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" diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake index ea3a445..0ded568 100644 --- a/Modules/CMakeSystemSpecificInformation.cmake +++ b/Modules/CMakeSystemSpecificInformation.cmake @@ -14,6 +14,7 @@ set(APPLE ) set(UNIX ) set(CYGWIN ) +set(MSYS ) set(WIN32 ) diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 28dffc0..c6a3451 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -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 ) diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake index 9b897bd..fc4ea2e 100644 --- a/Modules/Platform/CYGWIN.cmake +++ b/Modules/Platform/CYGWIN.cmake @@ -1,7 +1,7 @@ -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 diff --git a/Modules/Platform/MSYS-Clang-C.cmake b/Modules/Platform/MSYS-Clang-C.cmake new file mode 100644 index 0000000..f025b33 --- /dev/null +++ b/Modules/Platform/MSYS-Clang-C.cmake @@ -0,0 +1 @@ +include(Platform/CYGWIN-Clang-C) diff --git a/Modules/Platform/MSYS-Clang-CXX.cmake b/Modules/Platform/MSYS-Clang-CXX.cmake new file mode 100644 index 0000000..e509eaa --- /dev/null +++ b/Modules/Platform/MSYS-Clang-CXX.cmake @@ -0,0 +1 @@ +include(Platform/CYGWIN-Clang-CXX) diff --git a/Modules/Platform/MSYS-Determine-CXX.cmake b/Modules/Platform/MSYS-Determine-CXX.cmake new file mode 100644 index 0000000..dec17f0 --- /dev/null +++ b/Modules/Platform/MSYS-Determine-CXX.cmake @@ -0,0 +1 @@ +include(Platform/CYGWIN-Determine-CXX) diff --git a/Modules/Platform/MSYS-GNU-C.cmake b/Modules/Platform/MSYS-GNU-C.cmake new file mode 100644 index 0000000..e8343a4 --- /dev/null +++ b/Modules/Platform/MSYS-GNU-C.cmake @@ -0,0 +1 @@ +include(Platform/CYGWIN-GNU-C) diff --git a/Modules/Platform/MSYS-GNU-CXX.cmake b/Modules/Platform/MSYS-GNU-CXX.cmake new file mode 100644 index 0000000..67775de --- /dev/null +++ b/Modules/Platform/MSYS-GNU-CXX.cmake @@ -0,0 +1 @@ +include(Platform/CYGWIN-GNU-CXX) diff --git a/Modules/Platform/MSYS-GNU-Fortran.cmake b/Modules/Platform/MSYS-GNU-Fortran.cmake new file mode 100644 index 0000000..b0b7d8e --- /dev/null +++ b/Modules/Platform/MSYS-GNU-Fortran.cmake @@ -0,0 +1 @@ +include(Platform/CYGWIN-GNU-Fortran) diff --git a/Modules/Platform/MSYS-GNU.cmake b/Modules/Platform/MSYS-GNU.cmake new file mode 100644 index 0000000..012c112 --- /dev/null +++ b/Modules/Platform/MSYS-GNU.cmake @@ -0,0 +1 @@ +include(Platform/CYGWIN-GNU) diff --git a/Modules/Platform/MSYS-windres.cmake b/Modules/Platform/MSYS-windres.cmake new file mode 100644 index 0000000..faaccc2 --- /dev/null +++ b/Modules/Platform/MSYS-windres.cmake @@ -0,0 +1 @@ +include(Platform/CYGWIN-windres) diff --git a/Modules/Platform/MSYS.cmake b/Modules/Platform/MSYS.cmake new file mode 100644 index 0000000..96fa36f --- /dev/null +++ b/Modules/Platform/MSYS.cmake @@ -0,0 +1,4 @@ +set(MSYS 1) +include(Platform/CYGWIN) +set(CMAKE_SHARED_LIBRARY_PREFIX "msys-") +set(CMAKE_SHARED_MODULE_PREFIX "msys-") diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 938745c..c19c154 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -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) diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake index 7917d41..f20572e 100644 --- a/Source/Checks/cm_cxx_features.cmake +++ b/Source/Checks/cm_cxx_features.cmake @@ -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() diff --git a/Source/Modules/FindLibUUID.cmake b/Source/Modules/FindLibUUID.cmake index 17f11c1..ca5b61d 100644 --- a/Source/Modules/FindLibUUID.cmake +++ b/Source/Modules/FindLibUUID.cmake @@ -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. diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index ccfd727..5fbbef7 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -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"); diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 5382fac..aad5533 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -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 ""; diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index d6a20bc..ff9e9ec 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -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) diff --git a/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt b/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt index 7ca68ec..aca99ce 100644 --- a/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt @@ -36,7 +36,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES Intel) string (REGEX REPLACE ".*Version ([0-9]+(\\.[0-9]+)+).*" "\\1" _intel_version "${_intel_version_info}") endif() -message("Platform:\n WIN32: ${WIN32}\n UNIX: ${UNIX}\n APPLE: ${APPLE}\n MINGW: ${MINGW}\n CYGWIN: ${CYGWIN}\n" +message("Platform:\n WIN32: ${WIN32}\n UNIX: ${UNIX}\n APPLE: ${APPLE}\n MINGW: ${MINGW}\n CYGWIN: ${CYGWIN}\n MSYS: ${MSYS}\n" " MSVC: ${MSVC}\n MSVC60: ${MSVC60}\n MSVC70: ${MSVC70}\n MSVC71: ${MSVC71}\n MSVC80: ${MSVC80}\n MSVC90: ${MSVC90}\n MSVC10: ${MSVC10}\n" " GCC: ${_gcc_version}\n" " Clang: ${_clang_version}\n" diff --git a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in index f01e616..1254ff9 100644 --- a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in +++ b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in @@ -459,7 +459,28 @@ set(msys_g77_dirs "C:/some-mingw/lib/gcc/mingw32/3.4.5;C:/some-mingw/lib/gcc;/so list(APPEND platforms msys_g77) #----------------------------------------------------------------------------- -# MSYS2 +# MSYS2-runtime + +# gcc dummy.c -v +set(msys2rt_gcc_text " /usr/lib/gcc/i686-pc-msys/6.4.0/collect2.exe -Bdynamic --dll-search-prefix=msys- /usr/lib/gcc/i686-pc-msys/6.4.0/../../../crt0.o -L/usr/lib/gcc/i686-pc-msys/6.4.0 -L/usr/lib/gcc/i686-pc-msys/6.4.0 -L/usr/lib/gcc/i686-pc-msys/6.4.0/../../.. /home/user/AppData/Local/Temp/cczg1Arh.o -lgcc -lmsys-2.0 -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc") +set(msys2rt_gcc_libs "msys-2.0;user32;kernel32;advapi32;shell32") +set(msys2rt_gcc_dirs "/usr/lib/gcc/i686-pc-msys/6.4.0;/usr/lib") +list(APPEND platforms msysrt_gcc) + +# g++ dummy.cxx -v +set(msys2rt_g++_text " /usr/lib/gcc/i686-pc-msys/6.4.0/collect2.exe -Bdynamic --dll-search-prefix=msys- /usr/lib/gcc/i686-pc-msys/6.4.0/../../../crt0.o -L/usr/lib/gcc/i686-pc-msys/6.4.0 -L/usr/lib/gcc/i686-pc-msys/6.4.0 -L/usr/lib/gcc/i686-pc-msys/6.4.0/../../.. /home/user/AppData/Local/Temp/ccsvcDO6.o -lstdc++ -lgcc -lmsys-2.0 -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc") +set(msys2rt_g++_libs "stdc++;msys-2.0;user32;kernel32;advapi32;shell32") +set(msys2rt_g++_dirs "/usr/lib/gcc/i686-pc-msys/6.4.0;/usr/lib") +list(APPEND platforms msysrt_g++) + +# g77 dummy.f -v +set(msys2rt_g77_text "Configured with: ... LD=/opt/gcc-tools/bin/ld.exe /usr/lib/gcc/i686-pc-msys/6.4.0/collect2.exe -Bdynamic --dll-search-prefix=msys- -u ___register_frame_info -u ___deregister_frame_info /usr/lib/gcc/i686-pc-msys/6.4.0/../../../crt0.o /usr/lib/gcc/i686-pc-msys/6.4.0/crtbegin.o -L/usr/lib/gcc/i686-pc-msys/6.4.0 -L/usr/lib/gcc/i686-pc-msys/6.4.0 -L/usr/lib/gcc/i686-pc-msys/6.4.0/../../.. /home/user/AppData/Local/Temp/ccqRWKWg.o -lgfortranbegin -lgfortran -lgcc_s -lgcc_s -lgcc -lmsys-2.0 -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc_s -lgcc_s -lgcc /usr/lib/gcc/i686-pc-msys/6.4.0/crtend.o") +set(msys2rt_g77_libs "stdc++;msys-2.0;user32;kernel32;advapi32;shell32") +set(msys2rt_g77_dirs "/usr/lib/gcc/i686-pc-msys/6.4.0;/usr/lib") +list(APPEND platforms msysrt_g77) + +#----------------------------------------------------------------------------- +# MSYS2-mingw # gcc dummy.c -v set(msys2_gcc_text " C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/collect2.exe -plugin C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/liblto_plugin-0.dll -plugin-opt=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/lto-wrapper.exe -plugin-opt=-fresolution=C:/msys64/tmp/ccikz9Wf.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_eh -plugin-opt=-pass-through=-lmoldname -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -m i386pep -Bdynamic C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/crt2.o C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/crtbegin.o -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0 -LC:/msys64/mingw64/bin/../lib/gcc -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib -LC:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../.. C:/msys64/tmp/ccK0dTUv.o -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/lib/../lib/default-manifest.o C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.2.0/crtend.o") diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 7217f43..7ec41f3 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -189,7 +189,9 @@ find_package(ArchD 4.0 EXACT NAMES zot) unset(CMAKE_LIBRARY_ARCHITECTURE) # Test find_package() with CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS enabled -if(UNIX) +if(UNIX + AND NOT MSYS # FIXME: This works on CYGWIN but not on MSYS + ) # Create ./symlink pointing back here. execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink . "${CMAKE_CURRENT_SOURCE_DIR}/symlink") diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 5e16de0..db90a81 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -165,7 +165,7 @@ if(CMAKE_GENERATOR MATCHES "Ninja") endif() add_RunCMake_test(Ninja) set(NinjaMultiConfig_ARGS - -DCYGWIN=${CYGWIN} + -DCYGWIN=${CYGWIN} -DMSYS=${MSYS} ) if(CMake_TEST_Qt5 AND Qt5Core_FOUND) list(APPEND NinjaMultiConfig_ARGS -DCMake_TEST_Qt5=1 -DQt5Core_DIR=${Qt5Core_DIR} -DCMAKE_TEST_Qt5Core_Version=${Qt5Core_VERSION}) @@ -346,7 +346,7 @@ add_RunCMake_test(export) add_RunCMake_test(cmake_language) add_RunCMake_test(cmake_minimum_required) add_RunCMake_test(cmake_parse_arguments) -add_RunCMake_test(cmake_path) +add_RunCMake_test(cmake_path -DMSYS=${MSYS}) add_RunCMake_test(continue) add_executable(color_warning color_warning.c) add_executable(fake_build_command fake_build_command.c) @@ -367,14 +367,14 @@ add_RunCMake_test(ctest_skipped_test) add_RunCMake_test(ctest_update) add_RunCMake_test(ctest_upload) add_RunCMake_test(ctest_fixtures) -add_RunCMake_test(file) -add_RunCMake_test(file-CHMOD) +add_RunCMake_test(file -DMSYS=${MSYS}) +add_RunCMake_test(file-CHMOD -DMSYS=${MSYS}) if(HAVE_ELF_H OR CMAKE_SYSTEM_NAME STREQUAL "AIX") add_RunCMake_test(file-RPATH -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DHAVE_ELF_H=${HAVE_ELF_H}) endif() add_RunCMake_test(find_file) -add_RunCMake_test(find_library -DCYGWIN=${CYGWIN}) -add_RunCMake_test(find_package) +add_RunCMake_test(find_library -DCYGWIN=${CYGWIN} -DMSYS=${MSYS}) +add_RunCMake_test(find_package -DMSYS=${MSYS}) add_RunCMake_test(find_path) add_RunCMake_test(find_program -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}) add_RunCMake_test(foreach) @@ -512,7 +512,9 @@ else() message(STATUS "Could not find ctresalloc") endif() -if(NOT WIN32) +if(NOT WIN32 + AND NOT MSYS # FIXME: This works on CYGWIN but not on MSYS + ) add_RunCMake_test(SymlinkTrees) endif () @@ -616,7 +618,8 @@ endif() add_executable(pseudo_llvm-rc pseudo_llvm-rc.c) -add_RunCMake_test(CommandLine -DLLVM_RC=$<TARGET_FILE:pseudo_llvm-rc> -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCYGWIN=${CYGWIN} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}) +add_RunCMake_test(CommandLine -DLLVM_RC=$<TARGET_FILE:pseudo_llvm-rc> -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} + -DCYGWIN=${CYGWIN} -DMSYS=${MSYS} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}) add_RunCMake_test(CommandLineTar) if(CMAKE_PLATFORM_NO_VERSIONED_SONAME OR (NOT CMAKE_SHARED_LIBRARY_SONAME_FLAG AND NOT CMAKE_SHARED_LIBRARY_SONAME_C_FLAG)) @@ -625,7 +628,7 @@ else() set(NO_NAMELINK 0) endif() -add_RunCMake_test(install -DNO_NAMELINK=${NO_NAMELINK} -DCYGWIN=${CYGWIN} +add_RunCMake_test(install -DNO_NAMELINK=${NO_NAMELINK} -DCYGWIN=${CYGWIN} -DMSYS=${MSYS} -DCMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN=${CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN} -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DCMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG=${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG} diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index bf5a96e..78c3508 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -562,7 +562,7 @@ file(MAKE_DIRECTORY ${out}) run_cmake_command(E_cat_non_existing_file ${CMAKE_COMMAND} -E cat ${out}/non-existing-file.txt) -if(UNIX) +if(UNIX AND NOT MSYS) # test non readable file only if not root execute_process( COMMAND id -u $ENV{USER} @@ -801,7 +801,7 @@ function(reject_fifo) run_cmake_command(reject_fifo ${BASH_EXECUTABLE} -c ${BASH_COMMAND_ARGUMENT}) endif() endfunction() -if(CMAKE_HOST_UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "CYGWIN") +if(CMAKE_HOST_UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "CYGWIN" AND NOT CMAKE_SYSTEM_NAME STREQUAL "MSYS") reject_fifo() run_cmake_command(closed_stdin sh -c "\"${CMAKE_COMMAND}\" --version <&-") run_cmake_command(closed_stdout sh -c "\"${CMAKE_COMMAND}\" --version >&-") diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json index ce45947..4727607 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json @@ -119,7 +119,7 @@ "type": "target", "destination": "lib", "paths": [ - "^lib/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib|cyg)?c_shared_lib(-1)?\\.(dll|so)$" + "^lib/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib|cyg|msys-)?c_shared_lib(-1)?\\.(dll|so)$" ], "pathsNamelink": [ "^lib/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib)?c_shared_lib\\.(so\\.1\\.2\\.3|1\\.2\\.3\\.dylib)$", @@ -210,7 +210,7 @@ "type": "target", "destination": "lib", "paths": [ - "^cxx/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib|cyg)?cxx_shared_lib\\.(dll|so|dylib)$" + "^cxx/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?(lib|cyg|msys-)?cxx_shared_lib\\.(dll|so|dylib)$" ], "isExcludeFromAll": null, "isOptional": null, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json index 5588bd5..e3a8d0b 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json @@ -90,10 +90,10 @@ } ], "folder": null, - "nameOnDisk": "^(lib|cyg)?c_shared_lib(-1)?\\.(so|dylib|dll)$", + "nameOnDisk": "^(lib|cyg|msys-)?c_shared_lib(-1)?\\.(so|dylib|dll)$", "artifacts": [ { - "path": "^lib/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg)?c_shared_lib(-1)?\\.(so|dylib|dll)$", + "path": "^lib/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg|msys-)?c_shared_lib(-1)?\\.(so|dylib|dll)$", "_dllExtra": false }, { @@ -101,7 +101,7 @@ "_dllExtra": true }, { - "path": "^lib/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg)?c_shared_lib(-1)?\\.pdb$", + "path": "^lib/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg|msys-)?c_shared_lib(-1)?\\.pdb$", "_dllExtra": true } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json index e5e1d0d..73e8e12 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json @@ -66,10 +66,10 @@ } ], "folder": null, - "nameOnDisk": "^(lib|cyg)?cxx_shared_lib\\.(so|dylib|dll)$", + "nameOnDisk": "^(lib|cyg|msys-)?cxx_shared_lib\\.(so|dylib|dll)$", "artifacts": [ { - "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg)?cxx_shared_lib\\.(so|dylib|dll)$", + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg|msys-)?cxx_shared_lib\\.(so|dylib|dll)$", "_dllExtra": false }, { @@ -77,7 +77,7 @@ "_dllExtra": true }, { - "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg)?cxx_shared_lib\\.pdb$", + "path": "^cxx/((Debug|Release|RelWithDebInfo|MinSizeRel)/)?(lib|cyg|msys-)?cxx_shared_lib\\.pdb$", "_dllExtra": true } ], diff --git a/Tests/RunCMake/File_Generate/CustomFilePermissions.cmake b/Tests/RunCMake/File_Generate/CustomFilePermissions.cmake index 0000ef9..a5e66dc 100644 --- a/Tests/RunCMake/File_Generate/CustomFilePermissions.cmake +++ b/Tests/RunCMake/File_Generate/CustomFilePermissions.cmake @@ -11,5 +11,6 @@ file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$<LOWER_CASE:$<CONFIG>>/custom add_custom_target(checkCustomFilePermissions ALL COMMAND ${CMAKE_COMMAND} -DgeneratedFile=${CMAKE_CURRENT_BINARY_DIR}/$<LOWER_CASE:$<CONFIG>>/customfilepermissions.txt + -DMSYS=${MSYS} -P "${CMAKE_CURRENT_SOURCE_DIR}/CustomFilePermissionsVerify.cmake" ) diff --git a/Tests/RunCMake/File_Generate/CustomFilePermissionsVerify.cmake b/Tests/RunCMake/File_Generate/CustomFilePermissionsVerify.cmake index a87e916..2ef3281 100644 --- a/Tests/RunCMake/File_Generate/CustomFilePermissionsVerify.cmake +++ b/Tests/RunCMake/File_Generate/CustomFilePermissionsVerify.cmake @@ -2,7 +2,7 @@ if(NOT EXISTS "${generatedFile}") message(SEND_ERROR "Missing file:\n ${generatedFile}") endif() -if (UNIX) +if (UNIX AND NOT MSYS) find_program(STAT_EXECUTABLE NAMES stat) if(NOT STAT_EXECUTABLE) return() diff --git a/Tests/RunCMake/File_Generate/NoSourcePermissionsVerify.cmake b/Tests/RunCMake/File_Generate/NoSourcePermissionsVerify.cmake index 7981ccc..5e5b16a 100644 --- a/Tests/RunCMake/File_Generate/NoSourcePermissionsVerify.cmake +++ b/Tests/RunCMake/File_Generate/NoSourcePermissionsVerify.cmake @@ -2,7 +2,7 @@ if(NOT EXISTS "${generatedFile}") message(SEND_ERROR "Missing generated file:\n ${generatedFile}") endif() -if (UNIX) +if (UNIX AND NOT MSYS) find_program(STAT_EXECUTABLE NAMES stat) if(NOT STAT_EXECUTABLE) return() diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-imported-target.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-imported-target.cmake index 40f7c66..7eec527 100644 --- a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-imported-target.cmake +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME-imported-target.cmake @@ -58,8 +58,8 @@ set_property (TARGET static3 PROPERTY ARCHIVE_OUTPUT_NAME static3_archive) string (APPEND GENERATE_CONTENT [[ check_value ("TARGET_FILE_BASE_NAME executable all properties" "$<TARGET_FILE_BASE_NAME:exec3>" "exec3_runtime") -check_value ("TARGET_FILE_BASE_NAME shared all properties" "$<TARGET_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_runtime,shared3_library>") -check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties" "$<TARGET_LINKER_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_archive,shared3_library>") +check_value ("TARGET_FILE_BASE_NAME shared all properties" "$<TARGET_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN$<SEMICOLON>MSYS>,shared3_runtime,shared3_library>") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties" "$<TARGET_LINKER_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN$<SEMICOLON>MSYS>,shared3_archive,shared3_library>") check_value ("TARGET_FILE_BASE_NAME static all properties" "$<TARGET_FILE_BASE_NAME:static3>" "static3_archive") check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties" "$<TARGET_LINKER_FILE_BASE_NAME:static3>" "static3_archive") ]]) @@ -95,8 +95,8 @@ set_property (TARGET static4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) string (APPEND GENERATE_CONTENT [[ check_value ("TARGET_FILE_BASE_NAME executable all properties + postfix" "$<TARGET_FILE_BASE_NAME:exec4>" "exec4_runtime_postfix") -check_value ("TARGET_FILE_BASE_NAME shared all properties + postfix" "$<TARGET_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared4_runtime,shared4_library>_postfix") -check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared4_archive,shared4_library>_postfix") +check_value ("TARGET_FILE_BASE_NAME shared all properties + postfix" "$<TARGET_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN$<SEMICOLON>MSYS>,shared4_runtime,shared4_library>_postfix") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN$<SEMICOLON>MSYS>,shared4_archive,shared4_library>_postfix") check_value ("TARGET_FILE_BASE_NAME static all properties + postfix" "$<TARGET_FILE_BASE_NAME:static4>" "static4_archive_postfix") check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:static4>" "static4_archive_postfix") ]]) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME.cmake index f88d710..1963244 100644 --- a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME.cmake +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_BASE_NAME.cmake @@ -72,8 +72,8 @@ set_property (TARGET static3 PROPERTY PDB_NAME static3_pdb) string (APPEND GENERATE_CONTENT [[ check_value ("TARGET_FILE_BASE_NAME executable all properties" "$<TARGET_FILE_BASE_NAME:exec3>" "exec3_runtime") -check_value ("TARGET_FILE_BASE_NAME shared all properties" "$<TARGET_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_runtime,shared3_library>") -check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties" "$<TARGET_LINKER_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared3_archive,shared3_library>") +check_value ("TARGET_FILE_BASE_NAME shared all properties" "$<TARGET_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN$<SEMICOLON>MSYS>,shared3_runtime,shared3_library>") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties" "$<TARGET_LINKER_FILE_BASE_NAME:shared3>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN$<SEMICOLON>MSYS>,shared3_archive,shared3_library>") check_value ("TARGET_FILE_BASE_NAME static all properties" "$<TARGET_FILE_BASE_NAME:static3>" "static3_archive") check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties" "$<TARGET_LINKER_FILE_BASE_NAME:static3>" "static3_archive") ]]) @@ -118,8 +118,8 @@ set_property (TARGET static4 PROPERTY ${FIRST_CONFIG}_POSTFIX _postfix) string (APPEND GENERATE_CONTENT [[ check_value ("TARGET_FILE_BASE_NAME executable all properties + postfix" "$<TARGET_FILE_BASE_NAME:exec4>" "exec4_runtime_postfix") -check_value ("TARGET_FILE_BASE_NAME shared all properties + postfix" "$<TARGET_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared4_runtime,shared4_library>_postfix") -check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN>,shared4_archive,shared4_library>_postfix") +check_value ("TARGET_FILE_BASE_NAME shared all properties + postfix" "$<TARGET_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN$<SEMICOLON>MSYS>,shared4_runtime,shared4_library>_postfix") +check_value ("TARGET_LINKER_FILE_BASE_NAME shared linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:shared4>" "$<IF:$<IN_LIST:$<PLATFORM_ID>,Windows$<SEMICOLON>CYGWIN$<SEMICOLON>MSYS>,shared4_archive,shared4_library>_postfix") check_value ("TARGET_FILE_BASE_NAME static all properties + postfix" "$<TARGET_FILE_BASE_NAME:static4>" "static4_archive_postfix") check_value ("TARGET_LINKER_FILE_BASE_NAME static linker all properties + postfix" "$<TARGET_LINKER_FILE_BASE_NAME:static4>" "static4_archive_postfix") ]]) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-imported-target.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-imported-target.cmake index f52776e..cc9cd5a 100644 --- a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-imported-target.cmake +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX-imported-target.cmake @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.14) enable_language (C) -set (win_platforms Windows CYGWIN) +set (win_platforms Windows CYGWIN MSYS) set (GENERATE_CONTENT [[ macro (CHECK_VALUE test_msg value expected) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX.cmake index bef7bbf..edfb40c 100644 --- a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX.cmake +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_PREFIX.cmake @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.14) enable_language (C) -set (win_platforms Windows CYGWIN) +set (win_platforms Windows CYGWIN MSYS) set (GENERATE_CONTENT [[ macro (CHECK_VALUE test_msg value expected) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-imported-target.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-imported-target.cmake index cefeb86..3ee42a5 100644 --- a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-imported-target.cmake +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX-imported-target.cmake @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.14) enable_language (C) -set (win_platforms Windows CYGWIN) +set (win_platforms Windows CYGWIN MSYS) set (GENERATE_CONTENT [[ macro (CHECK_VALUE test_msg value expected) diff --git a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX.cmake b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX.cmake index 39e39fd..1fe75d9 100644 --- a/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX.cmake +++ b/Tests/RunCMake/GenEx-TARGET_FILE/TARGET_FILE_SUFFIX.cmake @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.14) enable_language (C) -set (win_platforms Windows CYGWIN) +set (win_platforms Windows CYGWIN MSYS) set (GENERATE_CONTENT [[ macro (CHECK_VALUE test_msg value expected) diff --git a/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp b/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp index dcaa4f2..ed8c35e 100644 --- a/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp +++ b/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp @@ -8,6 +8,14 @@ #include "libshared.h" #include "libstatic.h" +static void rtrim(std::string& str, char byte) +{ + const std::size_t size = str.size(); + if (size && str[size - 1] == byte) { + str.resize(size - 1); + } +} + void compare(const char* refName, const char* testName) { std::ifstream ref; @@ -31,16 +39,14 @@ void compare(const char* refName, const char* testName) // Some very old Borland runtimes (C++ Builder 5 WITHOUT Update 1) add a // trailing null to the string that we need to strip before testing for a // trailing space. - if (refLine.size() && refLine[refLine.size() - 1] == 0) { - refLine.resize(refLine.size() - 1); - } - if (testLine.size() && testLine[testLine.size() - 1] == 0) { - testLine.resize(testLine.size() - 1); - } + rtrim(refLine, 0); + rtrim(testLine, 0); // The reference files never have trailing spaces: - if (testLine.size() && testLine[testLine.size() - 1] == ' ') { - testLine.resize(testLine.size() - 1); - } + rtrim(testLine, ' '); + // Strip trailing CR. LF is not returned by getline, but CR is returned + // on some platforms. + rtrim(refLine, '\r'); + rtrim(testLine, '\r'); if (refLine != testLine) { std::cout << "Ref and test are not the same:\n Ref: \"" << refLine << "\"\n Test: \"" << testLine << "\"\n"; diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 7994fc2..b4a57b2 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -23,10 +23,13 @@ function(run_cmake test) endif() string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} platform_name) + #remove all additional bits from cygwin/msys name if(platform_name MATCHES cygwin) - #remove all additional bits from cygwin name set(platform_name cygwin) endif() + if(platform_name MATCHES msys) + set(platform_name msys) + endif() foreach(o out err) if(RunCMake-std${o}-file AND EXISTS ${top_src}/${RunCMake-std${o}-file}) diff --git a/Tests/RunCMake/configure_file/NoSourcePermissions.cmake b/Tests/RunCMake/configure_file/NoSourcePermissions.cmake index c6ad131..85533c4 100644 --- a/Tests/RunCMake/configure_file/NoSourcePermissions.cmake +++ b/Tests/RunCMake/configure_file/NoSourcePermissions.cmake @@ -1,7 +1,7 @@ configure_file(NoSourcePermissions.sh NoSourcePermissions.sh.out NO_SOURCE_PERMISSIONS) -if (UNIX) +if (UNIX AND NOT MSYS) execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/NoSourcePermissions.sh.out RESULT_VARIABLE result) if (result EQUAL "0") diff --git a/Tests/RunCMake/configure_file/SourcePermissions.cmake b/Tests/RunCMake/configure_file/SourcePermissions.cmake index c4d3d61..f8c506a 100644 --- a/Tests/RunCMake/configure_file/SourcePermissions.cmake +++ b/Tests/RunCMake/configure_file/SourcePermissions.cmake @@ -6,7 +6,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/sourcefile.txt WORLD_READ ) -if (CMAKE_HOST_UNIX) +if (CMAKE_HOST_UNIX AND NOT MSYS) find_program(STAT_EXECUTABLE NAMES stat) if(NOT STAT_EXECUTABLE) return() diff --git a/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake b/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake index c7bff15..18deb89 100644 --- a/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake +++ b/Tests/RunCMake/file-CHMOD/RunCMakeTest.cmake @@ -14,6 +14,6 @@ if(UNIX) OUTPUT_STRIP_TRAILING_WHITESPACE) endif() -if(NOT WIN32 AND NOT "${uid}" STREQUAL "0") +if(NOT WIN32 AND NOT MSYS AND NOT "${uid}" STREQUAL "0") run_cmake(CHMOD-write-only) endif() diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index 6d1109a..9efd3f4 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -87,7 +87,9 @@ run_cmake(GLOB-noexp-RELATIVE) run_cmake_command(GLOB-error-CONFIGURE_DEPENDS-SCRIPT_MODE ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/GLOB-error-CONFIGURE_DEPENDS-SCRIPT_MODE.cmake) -if(NOT WIN32 OR CYGWIN) +if(NOT WIN32 + AND NOT MSYS # FIXME: This works on CYGWIN but not on MSYS + ) run_cmake(CREATE_LINK-SYMBOLIC) run_cmake(CREATE_LINK-SYMBOLIC-noexist) run_cmake(GLOB_RECURSE-cyclic-recursion) @@ -162,7 +164,9 @@ else() run_cmake_command(GLOB-CONFIGURE_DEPENDS-RerunCMake-rebuild_second ${CMAKE_COMMAND} --build .) run_cmake_command(GLOB-CONFIGURE_DEPENDS-RerunCMake-nowork ${CMAKE_COMMAND} --build .) - if(NOT WIN32 OR CYGWIN) + if(NOT WIN32 + AND NOT MSYS # FIXME: This works on CYGWIN but not on MSYS + ) message(STATUS "GLOB-CONFIGURE_DEPENDS-CMP0009-RerunCMake: link the first test directory into a new directory...") file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}/test2") execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${RunCMake_TEST_BINARY_DIR}/test" "${RunCMake_TEST_BINARY_DIR}/test2/test_folder_symlink") diff --git a/Tests/RunCMake/find_file/FromPATHEnv-stdout-msys.txt b/Tests/RunCMake/find_file/FromPATHEnv-stdout-msys.txt new file mode 100644 index 0000000..6912bdf --- /dev/null +++ b/Tests/RunCMake/find_file/FromPATHEnv-stdout-msys.txt @@ -0,0 +1,9 @@ +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_File='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' +-- PrefixInPATH_File='PrefixInPATH_File-NOTFOUND' diff --git a/Tests/RunCMake/find_file/PrefixInPATH-stdout-msys.txt b/Tests/RunCMake/find_file/PrefixInPATH-stdout-msys.txt new file mode 100644 index 0000000..d73bc1d --- /dev/null +++ b/Tests/RunCMake/find_file/PrefixInPATH-stdout-msys.txt @@ -0,0 +1,4 @@ +-- PrefixInPATH_INCLUDE_DIR='PrefixInPATH_INCLUDE_DIR-NOTFOUND' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_file/include/PrefixInPATH.h' diff --git a/Tests/RunCMake/find_library/FromPATHEnv-stdout-msys.txt b/Tests/RunCMake/find_library/FromPATHEnv-stdout-msys.txt new file mode 100644 index 0000000..01e2720 --- /dev/null +++ b/Tests/RunCMake/find_library/FromPATHEnv-stdout-msys.txt @@ -0,0 +1,6 @@ +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='[^']*/Tests/RunCMake/find_library/FromPATHEnv-build/lib/libcreated.a' +-- CREATED_LIBRARY='[^']*/Tests/RunCMake/find_library/FromPATHEnv-build/lib/libcreated.a' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' +-- CREATED_LIBRARY='CREATED_LIBRARY-NOTFOUND' diff --git a/Tests/RunCMake/find_library/PrefixInPATH-stdout-msys.txt b/Tests/RunCMake/find_library/PrefixInPATH-stdout-msys.txt new file mode 100644 index 0000000..1ab884c --- /dev/null +++ b/Tests/RunCMake/find_library/PrefixInPATH-stdout-msys.txt @@ -0,0 +1,4 @@ +-- PrefixInPATH_LIBRARY='PrefixInPATH_LIBRARY-NOTFOUND' +-- PrefixInPATH_LIBRARY='.*/Tests/RunCMake/find_library/lib/libPrefixInPATH.a' +-- PrefixInPATH_LIBRARY='.*/Tests/RunCMake/find_library/lib/libPrefixInPATH.a' +-- PrefixInPATH_LIBRARY='.*/Tests/RunCMake/find_library/lib/libPrefixInPATH.a' diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake index a899f46..72ffcce 100644 --- a/Tests/RunCMake/find_package/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake @@ -40,6 +40,8 @@ run_cmake(VersionRangeConfig) run_cmake(VersionRangeConfig2) run_cmake(VersionRangeConfigStd) run_cmake(VersionRangeConfigStd2) -if(UNIX) +if(UNIX + AND NOT MSYS # FIXME: This works on CYGWIN but not on MSYS + ) run_cmake(SetFoundResolved) endif() diff --git a/Tests/RunCMake/find_path/FromPATHEnv-stdout-msys.txt b/Tests/RunCMake/find_path/FromPATHEnv-stdout-msys.txt new file mode 100644 index 0000000..8f3e7ca --- /dev/null +++ b/Tests/RunCMake/find_path/FromPATHEnv-stdout-msys.txt @@ -0,0 +1,9 @@ +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='.*/Tests/RunCMake/find_path/include' +-- PATH_IN_ENV_PATH='.*/Tests/RunCMake/find_path/include' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' +-- PATH_IN_ENV_PATH='PATH_IN_ENV_PATH-NOTFOUND' diff --git a/Tests/RunCMake/find_path/PrefixInPATH-stdout-msys.txt b/Tests/RunCMake/find_path/PrefixInPATH-stdout-msys.txt new file mode 100644 index 0000000..bb2ceb7 --- /dev/null +++ b/Tests/RunCMake/find_path/PrefixInPATH-stdout-msys.txt @@ -0,0 +1,4 @@ +-- PrefixInPATH_INCLUDE_DIR='PrefixInPATH_INCLUDE_DIR-NOTFOUND' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_path/include' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_path/include' +-- PrefixInPATH_INCLUDE_DIR='.*/Tests/RunCMake/find_path/include' diff --git a/Tests/RunCMake/find_program/RunCMakeTest.cmake b/Tests/RunCMake/find_program/RunCMakeTest.cmake index 3e23920..77c021d 100644 --- a/Tests/RunCMake/find_program/RunCMakeTest.cmake +++ b/Tests/RunCMake/find_program/RunCMakeTest.cmake @@ -6,7 +6,7 @@ run_cmake(NamesPerDir) run_cmake(RelAndAbsPath) run_cmake(Required) -if(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN)$") +if(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN|MSYS)$") run_cmake(WindowsCom) run_cmake(WindowsExe) else() diff --git a/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake b/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake index 4a55cd6..d099469 100644 --- a/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake +++ b/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake @@ -13,6 +13,21 @@ if(WIN32) [[mylib/(lib)?lib1\.(dll\.a|lib)]] [[mylib/(lib)?lib2\.(a|lib)]] ) +elseif(MSYS) + set(_check_files + [[lib3]] + [[lib3/liblib3\.dll\.a]] + [[lib4]] + [[lib4/msys-lib4\.dll]] + [[mybin]] + [[mybin/exe\.exe]] + [[mybin/msys-lib1\.dll]] + [[myinclude]] + [[myinclude/obj3\.h]] + [[mylib]] + [[mylib/liblib1\.dll\.a]] + [[mylib/liblib2\.a]] + ) elseif(CYGWIN) set(_check_files [[lib3]] diff --git a/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake b/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake index 30f2266..6e13b84 100644 --- a/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake +++ b/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake @@ -15,6 +15,23 @@ if(WIN32) [[lib4]] [[lib4/(lib)?lib4\.dll]] ) +elseif(MSYS) + set(_check_files + [[bin]] + [[bin/exe\.exe]] + [[bin/msys-lib1\.dll]] + [[include]] + [[include/obj1\.h]] + [[include/obj2\.h]] + [[include/obj3\.h]] + [[lib]] + [[lib/liblib1\.dll\.a]] + [[lib/liblib2\.a]] + [[lib3]] + [[lib3/liblib3\.dll\.a]] + [[lib4]] + [[lib4/msys-lib4\.dll]] + ) elseif(CYGWIN) set(_check_files [[bin]] diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake index bc9ebd1..e602af9 100644 --- a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake @@ -8,6 +8,16 @@ if(WIN32) [[lib/(lib)?namelink-uns-dev\.dll]] [[lib/(lib)?namelink-uns\.dll]] ) +elseif(MSYS) + set(_check_files + [[lib]] + [[lib/msys-namelink-none\.dll]] + [[lib/msys-namelink-same-1\.dll]] + [[lib/msys-namelink-sep-1\.dll]] + [[lib/msys-namelink-skip-1\.dll]] + [[lib/msys-namelink-uns-1\.dll]] + [[lib/msys-namelink-uns-dev-1\.dll]] + ) elseif(CYGWIN) set(_check_files [[lib]] diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake index 3f6be68..cd579eb 100644 --- a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake @@ -6,6 +6,14 @@ if(WIN32) [[lib/(lib)?namelink-sep\.dll]] [[lib/(lib)?namelink-skip\.dll]] ) +elseif(MSYS) + set(_check_files + [[lib]] + [[lib/msys-namelink-none\.dll]] + [[lib/msys-namelink-same-1\.dll]] + [[lib/msys-namelink-sep-1\.dll]] + [[lib/msys-namelink-skip-1\.dll]] + ) elseif(CYGWIN) set(_check_files [[lib]] diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake index 0033c88..ea68f4a 100644 --- a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake +++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake @@ -4,6 +4,12 @@ if(WIN32) [[lib/(lib)?namelink-uns-dev\.dll]] [[lib/(lib)?namelink-uns\.dll]] ) +elseif(MSYS) + set(_check_files + [[lib]] + [[lib/msys-namelink-uns-1\.dll]] + [[lib/msys-namelink-uns-dev-1\.dll]] + ) elseif(CYGWIN) set(_check_files [[lib]] diff --git a/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake index 5daecc8..91d5ef0 100644 --- a/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake +++ b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake @@ -4,6 +4,8 @@ if(WIN32) set(test45 [[bin/test4\.dll;bin/test4\.lib;bin/test5ar\.lib]]) check_installed("^bin;(${libtest45};${test123})|(${test123};${test45})\$") +elseif(MSYS) + check_installed([[^bin;bin/libtest4\.dll\.a;bin/libtest5ar\.a;bin/msys-test4\.dll;bin/test1out\.exe;bin/test2deb\.exe;bin/test3exc\.exe$]]) elseif(CYGWIN) check_installed([[^bin;bin/cygtest4\.dll;bin/libtest4\.dll\.a;bin/libtest5ar\.a;bin/test1out\.exe;bin/test2deb\.exe;bin/test3exc\.exe$]]) elseif(APPLE) diff --git a/Tests/SetLang/CMakeLists.txt b/Tests/SetLang/CMakeLists.txt index 3eb9185..80348ab 100644 --- a/Tests/SetLang/CMakeLists.txt +++ b/Tests/SetLang/CMakeLists.txt @@ -9,6 +9,10 @@ set_source_files_properties(foo.c bar.c PROPERTIES LANGUAGE CXX) target_link_libraries(SetLang foo) set_target_properties(SetLang PROPERTIES LINKER_LANGUAGE CXX) +# Windows defender blocks SetLang executable (https://cygwin.com/pipermail/cygwin/2021-January/247508.html) +# Coordinate this name with 'Tests/CMakeLists.txt'. +set_target_properties(SetLang PROPERTIES OUTPUT_NAME "SetLangX") + # VS generators historically tolerated target-wide -TP flags added # by project code, so cover that case to preserve the behavior. if(CMAKE_GENERATOR MATCHES "^Visual Studio" AND "x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC") diff --git a/Utilities/cmlibuv/CMakeLists.txt b/Utilities/cmlibuv/CMakeLists.txt index a4f0148..086345c 100644 --- a/Utilities/cmlibuv/CMakeLists.txt +++ b/Utilities/cmlibuv/CMakeLists.txt @@ -156,7 +156,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "OS400") ) endif() -if(CMAKE_SYSTEM_NAME MATCHES "CYGWIN") +if(CMAKE_SYSTEM_NAME MATCHES "CYGWIN" OR CMAKE_SYSTEM_NAME MATCHES "MSYS") list(APPEND uv_libraries ) list(APPEND uv_headers @@ -97,8 +97,17 @@ else cmake_system_cygwin=false fi +# Determine whether this is a MSYS environment. +if echo "${cmake_system}" | grep MSYS >/dev/null 2>&1; then + cmake_system_msys=true + cmake_doc_dir_keyword="MSYS" + cmake_man_dir_keyword="MSYS" +else + cmake_system_msys=false +fi + # Determine whether this is a MinGW environment. -if echo "${cmake_system}" | grep 'MINGW\|MSYS' >/dev/null 2>&1; then +if echo "${cmake_system}" | grep 'MINGW' >/dev/null 2>&1; then cmake_system_mingw=true else cmake_system_mingw=false @@ -1071,7 +1080,7 @@ else fi # Add Cygwin-specific flags -if ${cmake_system_cygwin}; then +if ${cmake_system_cygwin} || ${cmake_system_msys}; then cmake_ld_flags="${LDFLAGS} -Wl,--enable-auto-import" fi @@ -1096,6 +1105,7 @@ cmake_toolchains='' case "${cmake_system}" in *AIX*) cmake_toolchains='XL GNU' ;; *CYGWIN*) cmake_toolchains='GNU' ;; + *MSYS*) cmake_toolchains='GNU' ;; *Darwin*) cmake_toolchains='Clang GNU' ;; *Linux*) cmake_toolchains='GNU Clang XL PGI PathScale' ;; *MINGW*) cmake_toolchains='GNU' ;; |