Skip to content

Commit 1f42597

Browse files
TylerMSFTTylerMSFT
andauthored
new compiler switch: /ifcOutput (#4689)
* new compiler switch: /ifcOuput * fix line break * incorp feedback * a little more detail * add note about /mp * acrolinx * fix toc Co-authored-by: TylerMSFT <[email protected]>
1 parent b8c3b61 commit 1f42597

File tree

4 files changed

+62
-4
lines changed

4 files changed

+62
-4
lines changed

docs/build/reference/compiler-options-listed-alphabetically.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ This table contains an alphabetical list of compiler options. For a list of comp
111111
| [`/homeparams`](homeparams-copy-register-parameters-to-stack.md) | Forces parameters passed in registers to be written to their locations on the stack upon function entry. This compiler option is only for the x64 compilers (native and cross compile). |
112112
| [`/hotpatch`](hotpatch-create-hotpatchable-image.md) | Creates a hotpatchable image. |
113113
| [`/I<dir>`](i-additional-include-directories.md) | Searches a directory for include files. |
114-
| **`/ifcOutput`** | Specify output file or directory for *`.ifc`* files. |
114+
| [`/ifcOutput`](ifc-output.md) | Specify output file name or directory for built *`.ifc`* files. |
115115
| [`/interface`](interface.md) | Treat the input file as a module interface unit. |
116116
| [`/internalPartition`](internal-partition.md) | Treat the input file as an internal partition unit. |
117117
| [`/J`](j-default-char-type-is-unsigned.md) | Changes the default **`char`** type. |

docs/build/reference/compiler-options-listed-by-category.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ This article contains a categorical list of compiler options. For an alphabetica
137137
| [`/exportHeader`](module-exportheader.md) | Create the header units files (*`.ifc`*) specified by the input arguments. |
138138
| [`/headerUnit`](headerunit.md) | Specify where to find the header unit file (*`.ifc`*) for the specified header. |
139139
| [`/headerName`](headername.md) | Build a header unit from the specified header. |
140-
| **`/ifcOutput`** | Specify output file or directory for *`.ifc`* files. |
140+
| [`/ifcOutput`](ifc-output.md) | Specify the output file name or directory for built *`.ifc`* files. |
141141
| [`/interface`](interface.md) | Treat the input file as a module interface unit. |
142142
| [`/internalPartition`](internal-partition.md) | Treat the input file as an internal partition unit. |
143143
| [`/reference`](module-reference.md) | Use named module IFC. |

docs/build/reference/ifc-output.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
title: "/ifcOutput"
3+
description: "Specify output file or directory for `.ifc` files."
4+
ms.date: 11/21/2022
5+
author: "tylermsft"
6+
ms.author: "twhitney"
7+
f1_keywords: ["/ifcOutput", "VC.Project.VCCLCompilerTool.ifcOutput"]
8+
helpviewer_keywords: ["/ifcOutput", "Specify where the compiled `.ifc` should go"]
9+
---
10+
# `/ifcOutput`
11+
12+
This switch tells the compiler where to output built *`.ifc`* files. If the destination is a directory, then the compiler generates the name of each `.ifc` file based on the interface name or the header unit name.
13+
14+
## Syntax
15+
16+
> **`/ifcOutput`** *`filename`*\
17+
> **`/ifcOutput`** *`directory\`*
18+
19+
## Remarks
20+
21+
By default, the compiler derives the name for each generated *`.ifc`* file from the module interface name. For example, given a module name `MyModule`, the generated *`.ifc`* will be named *`MyModule.ifc`*, unless you override the name with the `/ifcOutput` switch.
22+
23+
Use this switch to specify an alternative *`.ifc`* filename or directory. If you want to use the default built *`.ifc`* filenames, but specify a directory where they should be built, ensure that you add a trailing backslash (`\`) to the directory name.
24+
25+
When you're building multiple *`.ifc`* files, only use the directory form of the `/ifcOutput` switch. If you provide multiple `/ifcOutput` switches, the compiler only uses the last one.
26+
27+
If you build with the [`/MP` (Build with multiple processes)](mp-build-with-multiple-processes.md) switch, we recommend that you use the directory form of the `/ifcOutput` switch if you have multiple input module files.
28+
29+
In the following example, the *`.ifc`* file for module `m` defined in *`m.ixx`* is built as `c:\example\m.ifc`.
30+
31+
```bash
32+
cl ... /c /std:c++latest m.ixx /ifcOutput c:\example\
33+
```
34+
35+
In the following example, the built *`.ifc`* file for module `m` defined in *`m.ixx`** is built as `c:\example\MyModule.ifc`:
36+
37+
```bash
38+
cl ... /c /std:c++latest m.ixx /ifcOutput c:\example\MyModule.ifc
39+
```
40+
41+
### To set this compiler option in the Visual Studio development environment
42+
43+
1. To apply the **`/ifcOutput`** option to one file in the IDE, select the file in **Solution Explorer**. Right-click to open the context menu and select **Properties** to open the **Property Pages** dialog.
44+
45+
1. Set the **Configuration** dropdown to **All Configurations**. Set the **Platform** dropdown to **All Platforms**.
46+
47+
1. Open the **Configuration Properties** > **C/C++** > **Output Files** property page.
48+
49+
1. Use the dropdown control to modify the **Module Output File Name** property to a directory name (ending in `\`) or an alternate file name. Or you can specify a directory + file name, for example, `c:\example\mymodule.ifc`. Choose **OK** or **Apply** to save your changes.
50+
51+
Alternatively, you can specify the `/ifcOutput` switch with a right-click on the project name in the **Solution Explorer** > **Configuration Properties** > **C/C++** > **Command Line**.
52+
53+
## See also
54+
55+
[Overview of modules in C++](../../cpp/modules-cpp.md)\
56+
[Using C++ Modules in MSVC from the Command Line](https://devblogs.microsoft.com/cppblog/using-cpp-modules-in-msvc-from-the-command-line-part-1/)

docs/build/toc.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,9 +616,11 @@ items:
616616
href: ../build/reference/hotpatch-create-hotpatchable-image.md
617617
- name: /I (Additional include directories)
618618
href: ../build/reference/i-additional-include-directories.md
619-
- name: /interface (treat input file as a module interface unit)
619+
- name: /ifcOutput (Specify where the compiled `.ifc` should go.)
620+
href: ../build/reference/ifc-output.md
621+
- name: /interface (Treat input file as a module interface unit)
620622
href: ../build/reference/interface.md
621-
- name: /internalPartition (treat the input file as an internal partition unit.)
623+
- name: /internalPartition (Treat the input file as an internal partition unit.)
622624
href: ../build/reference/internal-partition.md
623625
- name: /J (Default char type is unsigned)
624626
href: ../build/reference/j-default-char-type-is-unsigned.md

0 commit comments

Comments
 (0)