diff options
author | Brad King <brad.king@kitware.com> | 2019-03-11 14:43:38 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-03-11 15:37:52 (GMT) |
commit | 21da25d2a878cfccf9496ef7b227de2c98601ef2 (patch) | |
tree | aae2a5864971ae102d51b0f4a2a3eecd222a2b35 | |
parent | d1558fbf3ab770b8691a8548a297d1c48fe666eb (diff) | |
download | CMake-21da25d2a878cfccf9496ef7b227de2c98601ef2.zip CMake-21da25d2a878cfccf9496ef7b227de2c98601ef2.tar.gz CMake-21da25d2a878cfccf9496ef7b227de2c98601ef2.tar.bz2 |
Tests: Generalize GeneratorExpression MSYS path conversion workaround
Use MSYS2's `MSYS2_ARG_CONV_EXCL` environment variable to prevent
path conversion where possible.
-rw-r--r-- | Tests/GeneratorExpression/CMakeLists.txt | 28 | ||||
-rw-r--r-- | Tests/GeneratorExpression/check-part4.cmake | 4 |
2 files changed, 24 insertions, 8 deletions
diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index 3d08704..ab6016b 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -3,11 +3,26 @@ project(GeneratorExpression) include(CTest) +# Real projects normally want the MSYS shell path conversion, but for this test +# we need to verify that the command line is constructed with the proper string. +set(msys1_prefix "") +set(msys2_no_conv "") +if(CMAKE_GENERATOR STREQUAL "MSYS Makefiles") + execute_process(COMMAND "uname" OUTPUT_VARIABLE uname) + if("${uname}" MATCHES "^MINGW32") + # MinGW.org MSYS 1.0 does not support generic path conversion suppression + set(msys1_prefix MSYS1_PREFIX) + else() + # msys2 supports generic path conversion suppression + set(msys2_no_conv env MSYS2_ARG_CONV_EXCL=-D) + endif() +endif() + # This test is split into multiple parts as needed to avoid NMake command # length limits. add_custom_target(check-part1 ALL - COMMAND ${CMAKE_COMMAND} + COMMAND ${msys2_no_conv} ${CMAKE_COMMAND} -Dtest_0=$<0:nothing> -Dtest_0_with_comma=$<0:-Wl,--no-undefined> -Dtest_1=$<1:content> @@ -97,7 +112,7 @@ add_library(empty5 empty.cpp) target_include_directories(empty5 PRIVATE /empty5/private1 /empty5/private2) add_custom_target(check-part2 ALL - COMMAND ${CMAKE_COMMAND} + COMMAND ${msys2_no_conv} ${CMAKE_COMMAND} -Dtest_incomplete_1=$< -Dtest_incomplete_2=$<something -Dtest_incomplete_3=$<something: @@ -188,7 +203,7 @@ set_property(TARGET importedFallback PROPERTY MAP_IMPORTED_CONFIG_DEBUG "" DEBUG set_property(TARGET importedFallback PROPERTY MAP_IMPORTED_CONFIG_RELEASE "") add_custom_target(check-part3 ALL - COMMAND ${CMAKE_COMMAND} + COMMAND ${msys2_no_conv} ${CMAKE_COMMAND} -Dtest_version_greater_1=$<VERSION_GREATER:1.0,1.1.1> -Dtest_version_greater_2=$<VERSION_GREATER:1.1.1,1.0> -Dtest_version_less_1=$<VERSION_LESS:1.1.1,1.0> @@ -244,14 +259,13 @@ if(WIN32) else() set(test_shell_path /shell/path) endif() -set(path_prefix BYPASS_FURTHER_CONVERSION) add_custom_target(check-part4 ALL - COMMAND ${CMAKE_COMMAND} + COMMAND ${msys2_no_conv} ${CMAKE_COMMAND} # Prefix path to bypass its further conversion when being processed by # CMake as command-line argument - -Dtest_shell_path=${path_prefix}$<SHELL_PATH:${test_shell_path}> - -Dpath_prefix=${path_prefix} + -Dmsys1_prefix=${msys1_prefix} + -Dtest_shell_path=${msys1_prefix}$<SHELL_PATH:${test_shell_path}> -Dif_1=$<IF:1,a,b> -Dif_2=$<IF:0,a,b> -Dif_3=$<IF:$<EQUAL:10,30>,a,b> diff --git a/Tests/GeneratorExpression/check-part4.cmake b/Tests/GeneratorExpression/check-part4.cmake index f5d14dd..b6966de 100644 --- a/Tests/GeneratorExpression/check-part4.cmake +++ b/Tests/GeneratorExpression/check-part4.cmake @@ -1,6 +1,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/check-common.cmake) -string(REPLACE ${path_prefix} "" test_shell_path ${test_shell_path}) +if(msys1_prefix) + string(REPLACE "${msys1_prefix}" "" test_shell_path ${test_shell_path}) +endif() if(WIN32) if(CMAKE_GENERATOR STREQUAL "MSYS Makefiles") |