Skip to content

Commit 633dc34

Browse files
authored
Enabled passing --target to cmake --build (#245)
* Rename target to triplet * Add changeset * Pass --target to CMake when building
1 parent a336f07 commit 633dc34

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

.changeset/swift-loops-create.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"cmake-rn": minor
3+
---
4+
5+
Pass --target to CMake

packages/cmake-rn/src/cli.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ const defineOption = new Option(
102102
},
103103
);
104104

105+
const targetOption = new Option(
106+
"--target <target...>",
107+
"CMake targets to build",
108+
).default([] as string[], "Build all targets of the CMake project");
109+
105110
const noAutoLinkOption = new Option(
106111
"--no-auto-link",
107112
"Don't mark the output as auto-linkable by react-native-node-api",
@@ -122,6 +127,7 @@ let program = new Command("cmake-rn")
122127
.addOption(configurationOption)
123128
.addOption(defineOption)
124129
.addOption(cleanOption)
130+
.addOption(targetOption)
125131
.addOption(noAutoLinkOption)
126132
.addOption(noWeakNodeApiLinkageOption);
127133

@@ -335,6 +341,7 @@ async function buildProject<T extends string>(
335341
buildPath,
336342
"--config",
337343
configuration,
344+
...(options.target.length > 0 ? ["--target", ...options.target] : []),
338345
"--",
339346
...platform.buildArgs(context, options),
340347
],

0 commit comments

Comments
 (0)