Skip to content

Commit a9f3be0

Browse files
author
Mariusz Pasinski
committed
fix: include the generated (and corrected) CMakeList
This is basically the generated CMakeList file (from binding.gyp), but with fixed NAPI_VERSION to 4 (as the conversion tool does not respect this setting)
1 parent 6b441b5 commit a9f3be0

File tree

1 file changed

+15
-0
lines changed
  • packages/node-addon-examples/examples/1-getting-started/2_function_arguments_twisted/napi

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
cmake_minimum_required(VERSION 3.15)
2+
project(examples-1-getting-started-2_function_arguments_twisted-napi)
3+
4+
add_compile_definitions(-DNAPI_VERSION=4)
5+
6+
add_library(addon_twisted SHARED addon.c ${CMAKE_JS_SRC})
7+
set_target_properties(addon_twisted PROPERTIES PREFIX "" SUFFIX ".node")
8+
target_include_directories(addon_twisted PRIVATE ${CMAKE_JS_INC})
9+
target_link_libraries(addon_twisted PRIVATE ${CMAKE_JS_LIB})
10+
target_compile_features(addon_twisted PRIVATE cxx_std_17)
11+
12+
if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET)
13+
# Generate node.lib
14+
execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS})
15+
endif()

0 commit comments

Comments
 (0)