Skip to content

Commit 36cb9a0

Browse files
committed
Add FRAMEWORK in cmake-rn README.md
1 parent 3fb37ea commit 36cb9a0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

packages/cmake-rn/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,28 @@ To link against `weak-node-api` just include the CMake config exposed through `W
1616
cmake_minimum_required(VERSION 3.15...3.31)
1717
project(tests-buffers)
1818
19+
# Defines the "weak-node-api" target
1920
include(${WEAK_NODE_API_CONFIG})
2021
2122
add_library(addon SHARED addon.c)
2223
target_link_libraries(addon PRIVATE weak-node-api)
2324
target_compile_features(addon PRIVATE cxx_std_20)
25+
26+
if(APPLE)
27+
# Build frameworks when building for Apple (optional)
28+
set_target_properties(addon PROPERTIES
29+
FRAMEWORK TRUE
30+
MACOSX_FRAMEWORK_IDENTIFIER async_test.addon
31+
MACOSX_FRAMEWORK_SHORT_VERSION_STRING 1.0
32+
MACOSX_FRAMEWORK_BUNDLE_VERSION 1.0
33+
XCODE_ATTRIBUTE_SKIP_INSTALL NO
34+
)
35+
else()
36+
set_target_properties(addon PROPERTIES
37+
PREFIX ""
38+
SUFFIX .node
39+
)
40+
endif()
2441
```
2542

2643
This is different from how `cmake-js` "injects" the Node-API for linking (via `${CMAKE_JS_INC}`, `${CMAKE_JS_SRC}` and `${CMAKE_JS_LIB}`). To allow for interoperability between these tools, we inject these when you pass `--cmake-js` to `cmake-rn`.

0 commit comments

Comments
 (0)