Skip to content

Commit 37f2069

Browse files
committed
Expose includable WEAK_NODE_API_CONFIG to CMake projects
1 parent 633dc34 commit 37f2069

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

.changeset/three-colts-tie.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+
Expose includable WEAK_NODE_API_CONFIG to CMake projects

packages/cmake-rn/src/weak-node-api.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,14 @@ export function getWeakNodeApiVariables(triplet: SupportedTriplet) {
4949
`Include path with a ';' is not supported: ${includePath}`,
5050
);
5151
}
52+
const cmakeConfigPath = path.join(weakNodeApiPath, "weak-node-api.cmake");
53+
const libraryPath = getWeakNodeApiPath(triplet);
5254
return {
55+
// Expose an includable CMake config file declaring the weak-node-api target
56+
WEAK_NODE_API_CONFIG: cmakeConfigPath,
57+
WEAK_NODE_API_LIB: libraryPath,
58+
// For compatibility with cmake-js
5359
CMAKE_JS_INC: includePaths.join(";"),
54-
CMAKE_JS_LIB: getWeakNodeApiPath(triplet),
60+
CMAKE_JS_LIB: libraryPath,
5561
};
5662
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
add_library(weak-node-api SHARED IMPORTED)
2+
3+
set_target_properties(weak-node-api PROPERTIES
4+
IMPORTED_LOCATION "${WEAK_NODE_API_LIB}"
5+
INTERFACE_INCLUDE_DIRECTORIES "${WEAK_NODE_API_INC}"
6+
)

0 commit comments

Comments
 (0)