]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/d/doc/invoking-gdc/options-for-directory-search.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / d / doc / invoking-gdc / options-for-directory-search.rst
CommitLineData
c63539ff
ML
1..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6.. index:: directory options, options, directory search, search path
7
8.. _directory-options:
9
10Options for Directory Search
11****************************
12
13These options specify directories to search for files, libraries, and
14other parts of the compiler:
15
16.. option:: -Idir
17
18 .. index:: -I
19
20 Specify a directory to use when searching for imported modules at
21 compile time. Multiple :option:`-I` options can be used, and the
22 paths are searched in the same order.
23
24.. option:: -Jdir
25
26 .. index:: -J
27
28 Specify a directory to use when searching for files in string imports
29 at compile time. This switch is required in order to use
30 ``import(file)`` expressions. Multiple :option:`-J` options can be
31 used, and the paths are searched in the same order.
32
33.. option:: -Ldir
34
35 .. index:: -L
36
37 When linking, specify a library search directory, as with :command:`gcc`.
38
39.. option:: -Bdir
40
41 .. index:: -B
42
43 This option specifies where to find the executables, libraries,
44 source files, and data files of the compiler itself, as with :command:`gcc`.
45
46.. option:: -fmodule-file=module=spec
47
48 .. index:: -fmodule-file
49
50 This option manipulates file paths of imported modules, such that if an
51 imported module matches all or the leftmost part of :samp:`{module}`, the file
52 path in :samp:`{spec}` is used as the location to search for D sources.
53 This is used when the source file path and names are not the same as the
54 package and module hierarchy. Consider the following examples:
55
56 .. code-block:: c++
57
58 gdc test.d -fmodule-file=A.B=foo.d -fmodule-file=C=bar
59
60 This will tell the compiler to search in all import paths for the source
61 file :samp:`{foo.d}` when importing :samp:`{A.B}`, and the directory :samp:`{bar/}`
62 when importing :samp:`{C}`, as annotated in the following D code:
63
64 .. code-block:: c++
65
66 module test;
67 import A.B; // Matches A.B, searches for foo.d
68 import C.D.E; // Matches C, searches for bar/D/E.d
69 import A.B.C; // No match, searches for A/B/C.d
70
71.. option:: -imultilib dir
72
73 .. index:: -imultilib
74
75 Use :samp:`{dir}` as a subdirectory of the gcc directory containing
76 target-specific D sources and interfaces.
77
78.. option:: -iprefix prefix
79
80 .. index:: -iprefix
81
82 Specify :samp:`{prefix}` as the prefix for the gcc directory containing
83 target-specific D sources and interfaces. If the :samp:`{prefix}` represents
84 a directory, you should include the final ``'/'``.
85
86.. option:: -nostdinc
87
88 .. index:: -nostdinc
89
90 Do not search the standard system directories for D source and interface
91 files. Only the directories that have been specified with :option:`-I` options
3ed1b4ce 92 (and the directory of the current file, if appropriate) are searched.