Skip to content

Commit 9861bad

Browse files
authored
Assert the existence of CMakeList.txt before passing control to CMake (#242)
1 parent 2a30d8d commit 9861bad

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.changeset/social-rivers-tie.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"cmake-rn": patch
3+
---
4+
5+
Assert the existence of CMakeList.txt before passing control to CMake

packages/cmake-rn/src/cli.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
Option,
1010
spawn,
1111
oraPromise,
12+
assertFixable,
1213
} from "@react-native-node-api/cli-utils";
1314
import { isSupportedTriplet } from "react-native-node-api";
1415

@@ -131,6 +132,14 @@ for (const platform of platforms) {
131132

132133
program = program.action(
133134
async ({ target: requestedTargets, ...baseOptions }) => {
135+
assertFixable(
136+
fs.existsSync(path.join(baseOptions.source, "CMakeLists.txt")),
137+
`No CMakeLists.txt found in source directory: ${chalk.dim(baseOptions.source)}`,
138+
{
139+
instructions: `Change working directory into a directory with a CMakeLists.txt, create one or specify the correct source directory using --source`,
140+
},
141+
);
142+
134143
const buildPath = getBuildPath(baseOptions);
135144
if (baseOptions.clean) {
136145
await fs.promises.rm(buildPath, { recursive: true, force: true });

0 commit comments

Comments
 (0)