aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-10-16 15:51:13 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-10-16 15:51:13 -0400
commit3af2202ea4a5950541ee369a005f8e4484d544ab (patch)
treeb3faf3822771034c997b8202bc1c5da91b513581 /src/main.cpp
parent8cf3a4d586b675a239c9cfa1ea07fa9f59ebf0a4 (diff)
downloadzig-3af2202ea4a5950541ee369a005f8e4484d544ab.tar.gz
zig-3af2202ea4a5950541ee369a005f8e4484d544ab.zip
add -I command line parameter, same as clang
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index d5901f73bf..cd1f742181 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -88,8 +88,9 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) {
" --verbose-llvm-ir enable compiler debug output for LLVM IR\n"
" --verbose-cimport enable compiler debug output for C imports\n"
" --verbose-cc enable compiler debug output for C compilation\n"
- " -dirafter [dir] same as -isystem but do it last\n"
- " -isystem [dir] add additional search path for other .h files\n"
+ " -dirafter [dir] add directory to AFTER include search path\n"
+ " -isystem [dir] add directory to SYSTEM include search path\n"
+ " -I[dir] add directory to include search path\n"
" -mllvm [arg] (unsupported) forward an arg to LLVM's option processing\n"
" --override-lib-dir [arg] override path to Zig lib directory\n"
" -ffunction-sections places each function in a separate section\n"
@@ -708,6 +709,9 @@ int main(int argc, char **argv) {
if (strcmp(l, "c") == 0)
have_libc = true;
link_libs.append(l);
+ } else if (arg[1] == 'I' && arg[2] != 0) {
+ clang_argv.append("-I");
+ clang_argv.append(&arg[2]);
} else if (arg[1] == 'F' && arg[2] != 0) {
framework_dirs.append(&arg[2]);
} else if (strcmp(arg, "--pkg-begin") == 0) {
@@ -783,6 +787,9 @@ int main(int argc, char **argv) {
} else if (strcmp(arg, "-isystem") == 0) {
clang_argv.append("-isystem");
clang_argv.append(argv[i]);
+ } else if (strcmp(arg, "-I") == 0) {
+ clang_argv.append("-I");
+ clang_argv.append(argv[i]);
} else if (strcmp(arg, "-dirafter") == 0) {
clang_argv.append("-dirafter");
clang_argv.append(argv[i]);