summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/pseudo_emulator_custom_command.c
diff options
context:
space:
mode:
authorJean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>2016-05-04 17:30:19 (GMT)
committerBrad King <brad.king@kitware.com>2016-05-09 12:56:27 (GMT)
commit8c2cedc6243b281a0814b284abbcd1c45c42b085 (patch)
treeb4bd057053fff493dc9ed8f9538e5e039faa6e89 /Tests/RunCMake/pseudo_emulator_custom_command.c
parenteccfc0d185526b746b722ed3d3d1302515698c9e (diff)
downloadCMake-8c2cedc6243b281a0814b284abbcd1c45c42b085.zip
CMake-8c2cedc6243b281a0814b284abbcd1c45c42b085.tar.gz
CMake-8c2cedc6243b281a0814b284abbcd1c45c42b085.tar.bz2
CustomCommandGenerator: Add support for CROSSCOMPILING_EMULATOR
Teach the `add_custom_command` and `add_custom_target' commands to substitute argv0 with the crosscompiling emulator if it is a target with the `CROSSCOMPILING_EMULATOR` property set.
Diffstat (limited to 'Tests/RunCMake/pseudo_emulator_custom_command.c')
-rw-r--r--Tests/RunCMake/pseudo_emulator_custom_command.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/Tests/RunCMake/pseudo_emulator_custom_command.c b/Tests/RunCMake/pseudo_emulator_custom_command.c
new file mode 100644
index 0000000..17181c9
--- /dev/null
+++ b/Tests/RunCMake/pseudo_emulator_custom_command.c
@@ -0,0 +1,34 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+// Usage:
+//
+// /path/to/program arg1 [arg2 [...]]
+//
+// Return EXIT_SUCCESS if 'generated_exe_emulator_expected'
+// string was found in <arg1>.
+// Return EXIT_FAILURE if 'generated_exe_emulator_unexpected'
+// string was found in <arg1>.
+
+int main(int argc, const char* argv[])
+{
+ const char* substring_failure = "generated_exe_emulator_unexpected";
+ const char* substring_success = "generated_exe_emulator_expected";
+ const char* str = argv[1];
+ if (argc < 2)
+ {
+ return EXIT_FAILURE;
+ }
+ if (strstr(str, substring_success) != 0)
+ {
+ return EXIT_SUCCESS;
+ }
+ if (strstr(str, substring_failure) != 0)
+ {
+ return EXIT_FAILURE;
+ }
+ fprintf(stderr, "Failed to find string '%s' in '%s'\n",
+ substring_success, str);
+ return EXIT_FAILURE;
+}