summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/separate_arguments/NativeCommand.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/separate_arguments/NativeCommand.cmake')
-rw-r--r--Tests/RunCMake/separate_arguments/NativeCommand.cmake19
1 files changed, 19 insertions, 0 deletions
diff --git a/Tests/RunCMake/separate_arguments/NativeCommand.cmake b/Tests/RunCMake/separate_arguments/NativeCommand.cmake
new file mode 100644
index 0000000..1cb009e
--- /dev/null
+++ b/Tests/RunCMake/separate_arguments/NativeCommand.cmake
@@ -0,0 +1,19 @@
+set(unix_cmd "a \"b c\" 'd e' \";\" \\ \\'\\\" '\\'' \"\\\"\"")
+set(unix_exp "a;b c;d e;\;; '\";';\"")
+
+set(windows_cmd "a \"b c\" 'd e' \";\" \\ \"c:\\windows\\path\\\\\" \\\"")
+set(windows_exp "a;b c;'d;e';\;;\\;c:\\windows\\path\\;\"")
+
+if(CMAKE_HOST_WIN32)
+ set(native_cmd "${windows_cmd}")
+ set(native_exp "${windows_exp}")
+else()
+ set(native_cmd "${unix_cmd}")
+ set(native_exp "${unix_exp}")
+endif()
+separate_arguments(native_out NATIVE_COMMAND "${native_cmd}")
+
+if(NOT "${native_out}" STREQUAL "${native_exp}")
+ message(FATAL_ERROR "separate_arguments native-style failed. "
+ "Expected\n [${native_exp}]\nbut got\n [${native_out}]\n")
+endif()