1 |
|
2 | if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.1.0)
|
3 | message(FATAL_ERROR "FindNodeJS.cmake uses CMake 3.1+ features")
|
4 | endif()
|
5 |
|
6 |
|
7 | if(NOT CMAKE_BUILD_TYPE)
|
8 | set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type" FORCE)
|
9 | endif()
|
10 |
|
11 |
|
12 | set(NodeJS_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
|
13 | get_filename_component(NodeJS_MODULE_NAME ${NodeJS_MODULE_PATH} NAME)
|
14 |
|
15 |
|
16 | set(NodeJS_ROOT_DIR "" CACHE PATH
|
17 | "The root directory of the node.js installed package")
|
18 |
|
19 |
|
20 | option(NodeJS_DOWNLOAD "Download the required source files" Off)
|
21 |
|
22 |
|
23 | option(NodeJS_FORCE_DOWNLOAD "Download the source files every time" Off)
|
24 |
|
25 |
|
26 | option(NodeJS_FORCE_EXTRACT "Extract the archive every time" Off)
|
27 |
|
28 |
|
29 | option(NodeJS_USE_CLANG_STDLIB "Use libc++ when compiling with clang" On)
|
30 | if(APPLE)
|
31 | set(NodeJS_USE_CLANG_STDLIB On CACHE BOOL "" FORCE)
|
32 | endif()
|
33 |
|
34 | if(WIN32)
|
35 |
|
36 | option(NodeJS_DOWNLOAD_EXECUTABLE
|
37 | "Download matching executable if available" Off
|
38 | )
|
39 | endif()
|
40 |
|
41 |
|
42 |
|
43 | find_program(NodeJS_EXECUTABLE
|
44 | NAMES node
|
45 | PATHS ${NodeJS_ROOT_DIR}
|
46 | PATH_SUFFIXES nodejs node
|
47 | )
|
48 | set(NodeJS_VALIDATE_EXECUTABLE 1)
|
49 | if(NodeJS_EXECUTABLE)
|
50 | execute_process(
|
51 | COMMAND ${NodeJS_EXECUTABLE} --version
|
52 | RESULT_VARIABLE NodeJS_VALIDATE_EXECUTABLE
|
53 | OUTPUT_VARIABLE NodeJS_INSTALLED_VERSION
|
54 | OUTPUT_STRIP_TRAILING_WHITESPACE
|
55 | )
|
56 | execute_process(
|
57 | COMMAND ${NodeJS_EXECUTABLE} -p "process.platform"
|
58 | OUTPUT_VARIABLE NodeJS_INSTALLED_PLATFORM
|
59 | OUTPUT_STRIP_TRAILING_WHITESPACE
|
60 | )
|
61 | execute_process(
|
62 | COMMAND ${NodeJS_EXECUTABLE} -p "process.arch"
|
63 | OUTPUT_VARIABLE NodeJS_INSTALLED_ARCH
|
64 | OUTPUT_STRIP_TRAILING_WHITESPACE
|
65 | )
|
66 | endif()
|
67 |
|
68 |
|
69 | if(NOT NodeJS_VALIDATE_EXECUTABLE EQUAL 0)
|
70 | find_program(NodeJS_EXECUTABLE
|
71 | NAMES nodejs
|
72 | PATHS ${NodeJS_ROOT_DIR}
|
73 | PATH_SUFFIXES nodejs node
|
74 | )
|
75 | set(NodeJS_VALIDATE_EXECUTABLE 1)
|
76 | if(NodeJS_EXECUTABLE)
|
77 | execute_process(
|
78 | COMMAND ${NodeJS_EXECUTABLE} --version
|
79 | RESULT_VARIABLE NodeJS_VALIDATE_EXECUTABLE
|
80 | OUTPUT_VARIABLE NodeJS_INSTALLED_VERSION
|
81 | OUTPUT_STRIP_TRAILING_WHITESPACE
|
82 | )
|
83 | endif()
|
84 |
|
85 | if(NOT NodeJS_VALIDATE_EXECUTABLE EQUAL 0)
|
86 | message(WARNING "Node.js executable could not be found. \
|
87 | Set NodeJS_ROOT_DIR to the installed location of the executable or \
|
88 | install Node.js to its default location.")
|
89 | endif()
|
90 | endif()
|
91 |
|
92 |
|
93 | list(APPEND NodeJS_OTHER_COMPONENTS
|
94 | X64 IA32 ARM WIN32 LINUX DARWIN
|
95 | )
|
96 | set(NodeJS_COMPONENTS_CONTAINS_VARIANT False)
|
97 | foreach(NodeJS_COMPONENT ${NodeJS_FIND_COMPONENTS})
|
98 | list(FIND NodeJS_OTHER_COMPONENTS ${NodeJS_COMPONENT} NodeJS_OTHER_INDEX)
|
99 | if(NodeJS_OTHER_INDEX EQUAL -1)
|
100 | set(NodeJS_COMPONENTS_CONTAINS_VARIANT True)
|
101 | break()
|
102 | endif()
|
103 | endforeach()
|
104 |
|
105 |
|
106 | if(NOT NodeJS_VERSION)
|
107 | if(NodeJS_FIND_VERSION)
|
108 | set(NodeJS_VERSION ${NodeJS_FIND_VERSION})
|
109 | elseif(NodeJS_INSTALLED_VERSION AND NOT NodeJS_COMPONENTS_CONTAINS_VARIANT)
|
110 | string(SUBSTRING ${NodeJS_INSTALLED_VERSION} 1 -1 NodeJS_VERSION)
|
111 | else()
|
112 | message(FATAL_ERROR "Node.js version is not set. Set the VERSION \
|
113 | property of the find_package command to the required version of the \
|
114 | Node.js sources")
|
115 | endif()
|
116 | endif()
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 | set(NodeJS_PLATFORM "" CACHE STRING "Target node.js platform for module")
|
126 | if(NOT NodeJS_PLATFORM)
|
127 | if(NodeJS_EXECUTABLE)
|
128 | set(NodeJS_PLATFORM ${NodeJS_INSTALLED_PLATFORM})
|
129 | elseif(WIN32)
|
130 | set(NodeJS_PLATFORM "win32")
|
131 | elseif(UNIX)
|
132 | if(APPLE)
|
133 | set(NodeJS_PLATFORM "darwin")
|
134 | else()
|
135 | set(NodeJS_PLATFORM "linux")
|
136 | endif()
|
137 | else()
|
138 | message(FATAL_ERROR "Node.js platform is not set. Add the platform \
|
139 | to the find_package components section or set NodeJS_PLATFORM in the \
|
140 | cache.")
|
141 | endif()
|
142 | endif()
|
143 |
|
144 |
|
145 | if(NodeJS_PLATFORM STREQUAL "win32")
|
146 | set(NodeJS_PLATFORM_WIN32 True)
|
147 | set(NodeJS_PLATFORM_LINUX False)
|
148 | set(NodeJS_PLATFORM_DARWIN False)
|
149 | elseif(NodeJS_PLATFORM STREQUAL "linux")
|
150 | set(NodeJS_PLATFORM_WIN32 False)
|
151 | set(NodeJS_PLATFORM_LINUX True)
|
152 | set(NodeJS_PLATFORM_DARWIN False)
|
153 | elseif(NodeJS_PLATFORM STREQUAL "darwin")
|
154 | set(NodeJS_PLATFORM_WIN32 False)
|
155 | set(NodeJS_PLATFORM_LINUX False)
|
156 | set(NodeJS_PLATFORM_DARWIN True)
|
157 | endif()
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 | set(NodeJS_ARCH "" CACHE STRING "Target node.js architecture for module")
|
167 | if(NOT NodeJS_ARCH)
|
168 | if(NodeJS_EXECUTABLE)
|
169 | set(NodeJS_ARCH ${NodeJS_INSTALLED_ARCH})
|
170 | elseif(MSVC)
|
171 | if(CMAKE_CL_64)
|
172 | set(NodeJS_ARCH "x64")
|
173 | else()
|
174 | set(NodeJS_ARCH "ia32")
|
175 | endif()
|
176 | else()
|
177 | message(FATAL_ERROR "Node.js architecture is not set. Add the \
|
178 | architecture to the find_package components section or set NodeJS_ARCH \
|
179 | in the cache.")
|
180 | endif()
|
181 | endif()
|
182 |
|
183 |
|
184 | if(NodeJS_ARCH STREQUAL "x64")
|
185 | set(NodeJS_ARCH_X64 True)
|
186 | set(NodeJS_ARCH_IA32 False)
|
187 | set(NodeJS_ARCH_ARM False)
|
188 | elseif(NodeJS_ARCH STREQUAL "ia32")
|
189 | set(NodeJS_ARCH_X64 False)
|
190 | set(NodeJS_ARCH_IA32 True)
|
191 | set(NodeJS_ARCH_ARM False)
|
192 | elseif(NodeJS_ARCH STREQUAL "arm")
|
193 | set(NodeJS_ARCH_X64 False)
|
194 | set(NodeJS_ARCH_IA32 False)
|
195 | set(NodeJS_ARCH_ARM True)
|
196 | endif()
|
197 |
|
198 |
|
199 | include(util/NodeJSUtil)
|
200 |
|
201 |
|
202 |
|
203 | set(NodeJS_DEFAULT_VARIANT_NAME "node.js")
|
204 |
|
205 |
|
206 |
|
207 | set(NodeJS_VARIANT_NAME "")
|
208 | set(NodeJS_VARIANT_BASE "")
|
209 | set(NodeJS_URL "")
|
210 | set(NodeJS_SOURCE_PATH "")
|
211 | set(NodeJS_CHECKSUM_PATH "")
|
212 | set(NodeJS_CHECKSUM_TYPE "")
|
213 | set(NodeJS_WIN32_LIBRARY_PATH "")
|
214 | set(NodeJS_WIN32_BINARY_PATH "")
|
215 | set(NodeJS_WIN32_LIBRARY_NAME "")
|
216 | set(NodeJS_WIN32_BINARY_NAME "")
|
217 |
|
218 | set(NodeJS_DEFAULT_INCLUDE True)
|
219 | set(NodeJS_DEFAULT_LIBS True)
|
220 | set(NodeJS_HAS_WIN32_PREFIX True)
|
221 | set(NodeJS_HAS_WIN32_BINARY True)
|
222 | set(NodeJS_HAS_OPENSSL True)
|
223 | set(NodeJS_HEADER_VERSION 0.12.7)
|
224 | set(NodeJS_SHA256_VERSION 0.7.0)
|
225 | set(NodeJS_PREFIX_VERSION 0.12.7)
|
226 | set(NodeJS_CXX11R_VERSION 0.12.7)
|
227 | set(NodeJS_SOURCE_INCLUDE True)
|
228 | set(NodeJS_HEADER_INCLUDE False)
|
229 | set(NodeJS_INCLUDE_PATHS "")
|
230 | set(NodeJS_LIBRARIES "")
|
231 | set(NodeJS_WIN32_DELAYLOAD "")
|
232 |
|
233 |
|
234 |
|
235 |
|
236 | file(
|
237 | GLOB NodeJS_SUPPORTED_VARIANTS
|
238 | RELATIVE ${CMAKE_CURRENT_LIST_DIR}/variants
|
239 | ${CMAKE_CURRENT_LIST_DIR}/variants/*
|
240 | )
|
241 | foreach(NodeJS_SUPPORTED_VARIANT ${NodeJS_SUPPORTED_VARIANTS})
|
242 | get_filename_component(NodeJS_SUPPORTED_VARIANT_NAME
|
243 | ${NodeJS_SUPPORTED_VARIANT} NAME_WE
|
244 | )
|
245 | if(NOT NodeJS_SUPPORTED_VARIANT_NAME STREQUAL "NodeJS")
|
246 | include(variants/${NodeJS_SUPPORTED_VARIANT_NAME})
|
247 | endif()
|
248 | endforeach()
|
249 | include(variants/NodeJS)
|
250 |
|
251 |
|
252 | set(NodeJS_VERSION_STRING "v${NodeJS_VERSION}")
|
253 |
|
254 |
|
255 | string(REPLACE "." ";" NodeJS_VERSION_PARTS ${NodeJS_VERSION})
|
256 | list(GET NodeJS_VERSION_PARTS 0 NodeJS_VERSION_MAJOR)
|
257 | list(GET NodeJS_VERSION_PARTS 1 NodeJS_VERSION_MINOR)
|
258 | list(GET NodeJS_VERSION_PARTS 2 NodeJS_VERSION_PATCH)
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 | if((NOT NodeJS_PLATFORM_WIN32) AND (NOT NodeJS_DOWNLOAD) AND
|
266 | NodeJS_VARIANT_NAME STREQUAL NodeJS_DEFAULT_VARIANT_NAME AND
|
267 | NodeJS_INSTALLED_VERSION STREQUAL NodeJS_VERSION_STRING AND
|
268 | NodeJS_INSTALLED_PLATFORM STREQUAL NodeJS_PLATFORM AND
|
269 | NodeJS_INSTALLED_ARCH STREQUAL NodeJS_ARCH)
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 | find_path(NodeJS_INCLUDE_PARENT node/node.h)
|
277 | set(NodeJS_INCLUDE_DIRS ${NodeJS_INCLUDE_PARENT}/node)
|
278 |
|
279 |
|
280 |
|
281 | set(NodeJS_LIBRARIES "")
|
282 |
|
283 |
|
284 |
|
285 | else()
|
286 |
|
287 | set(NodeJS_DOWNLOAD_PATH
|
288 | ${CMAKE_CURRENT_BINARY_DIR}/${NodeJS_VARIANT_BASE}
|
289 | )
|
290 | set(NodeJS_DOWNLOAD_PATH ${NodeJS_DOWNLOAD_PATH}-${NodeJS_VERSION_STRING})
|
291 | file(MAKE_DIRECTORY ${NodeJS_DOWNLOAD_PATH})
|
292 |
|
293 |
|
294 |
|
295 |
|
296 | set(NodeJS_CHECKSUM_FILE ${NodeJS_DOWNLOAD_PATH}/CHECKSUM)
|
297 | nodejs_download(
|
298 | ${NodeJS_URL}/${NodeJS_CHECKSUM_PATH}
|
299 | ${NodeJS_CHECKSUM_FILE}
|
300 | ${NodeJS_FORCE_DOWNLOAD}
|
301 | )
|
302 | file(READ ${NodeJS_CHECKSUM_FILE} NodeJS_CHECKSUM_DATA)
|
303 |
|
304 |
|
305 | set(NodeJS_SOURCE_FILE ${NodeJS_DOWNLOAD_PATH}/headers.tar.gz)
|
306 | nodejs_checksum(
|
307 | ${NodeJS_CHECKSUM_DATA} ${NodeJS_SOURCE_PATH} NodeJS_SOURCE_CHECKSUM
|
308 | )
|
309 | nodejs_download(
|
310 | ${NodeJS_URL}/${NodeJS_SOURCE_PATH}
|
311 | ${NodeJS_SOURCE_FILE}
|
312 | ${NodeJS_SOURCE_CHECKSUM}
|
313 | ${NodeJS_CHECKSUM_TYPE}
|
314 | ${NodeJS_FORCE_DOWNLOAD}
|
315 | )
|
316 | set(NodeJS_HEADER_PATH ${NodeJS_DOWNLOAD_PATH}/src)
|
317 | nodejs_extract(
|
318 | ${NodeJS_SOURCE_FILE}
|
319 | ${NodeJS_HEADER_PATH}
|
320 | ${NodeJS_FORCE_EXTRACT}
|
321 | )
|
322 |
|
323 |
|
324 | foreach(NodeJS_HEADER_BASE ${NodeJS_INCLUDE_PATHS})
|
325 | set(NodeJS_INCLUDE_DIR ${NodeJS_HEADER_PATH}/${NodeJS_HEADER_BASE})
|
326 | if(NOT EXISTS ${NodeJS_INCLUDE_DIR})
|
327 | message(FATAL_ERROR "Include does not exist: ${NodeJS_INCLUDE_DIR}")
|
328 | endif()
|
329 | list(APPEND NodeJS_INCLUDE_DIRS ${NodeJS_INCLUDE_DIR})
|
330 | endforeach()
|
331 |
|
332 |
|
333 | if(NodeJS_PLATFORM_WIN32)
|
334 |
|
335 | set(NodeJS_WIN32_LIBRARY_FILE
|
336 | ${NodeJS_DOWNLOAD_PATH}/lib/${NodeJS_ARCH}
|
337 | )
|
338 | set(NodeJS_WIN32_LIBRARY_FILE
|
339 | ${NodeJS_WIN32_LIBRARY_FILE}/${NodeJS_WIN32_LIBRARY_NAME}
|
340 | )
|
341 | nodejs_checksum(
|
342 | ${NodeJS_CHECKSUM_DATA} ${NodeJS_WIN32_LIBRARY_PATH}
|
343 | NodeJS_WIN32_LIBRARY_CHECKSUM
|
344 | )
|
345 | nodejs_download(
|
346 | ${NodeJS_URL}/${NodeJS_WIN32_LIBRARY_PATH}
|
347 | ${NodeJS_WIN32_LIBRARY_FILE}
|
348 | ${NodeJS_WIN32_LIBRARY_CHECKSUM}
|
349 | ${NodeJS_CHECKSUM_TYPE}
|
350 | ${NodeJS_FORCE_DOWNLOAD}
|
351 | )
|
352 | list(APPEND NodeJS_LIBRARIES ${NodeJS_WIN32_LIBRARY_FILE})
|
353 |
|
354 |
|
355 | if(NodeJS_WIN32_BINARY_PATH AND
|
356 | NodeJS_DOWNLOAD_EXECUTABLE)
|
357 | set(NodeJS_WIN32_BINARY_FILE
|
358 | ${NodeJS_DOWNLOAD_PATH}/lib/${NodeJS_ARCH}
|
359 | )
|
360 | set(NodeJS_WIN32_BINARY_FILE
|
361 | ${NodeJS_WIN32_BINARY_FILE}/${NodeJS_WIN32_BINARY_NAME}
|
362 | )
|
363 | nodejs_checksum(
|
364 | ${NodeJS_CHECKSUM_DATA} ${NodeJS_WIN32_BINARY_PATH}
|
365 | NodeJS_WIN32_BINARY_CHECKSUM
|
366 | )
|
367 | nodejs_download(
|
368 | ${NodeJS_URL}/${NodeJS_WIN32_BINARY_PATH}
|
369 | ${NodeJS_WIN32_BINARY_FILE}
|
370 | ${NodeJS_WIN32_BINARY_CHECKSUM}
|
371 | ${NodeJS_CHECKSUM_TYPE}
|
372 | ${NodeJS_FORCE_DOWNLOAD}
|
373 | )
|
374 | endif()
|
375 | endif()
|
376 | endif()
|
377 |
|
378 |
|
379 | if(NodeJS_PLATFORM_WIN32)
|
380 | list(APPEND NodeJS_LINK_FLAGS /IGNORE:4199)
|
381 | set(NodeJS_WIN32_DELAYLOAD_CONDITION "")
|
382 | foreach(NodeJS_WIN32_DELAYLOAD_BINARY ${NodeJS_WIN32_DELAYLOAD})
|
383 | list(APPEND NodeJS_LINK_FLAGS
|
384 | /DELAYLOAD:${NodeJS_WIN32_DELAYLOAD_BINARY}
|
385 | )
|
386 | list(APPEND NodeJS_WIN32_DELAYLOAD_CONDITION
|
387 | "_stricmp(info->szDll, \"${NodeJS_WIN32_DELAYLOAD_BINARY}\") != 0"
|
388 | )
|
389 | endforeach()
|
390 | string(REPLACE ";" " &&\n "
|
391 | NodeJS_WIN32_DELAYLOAD_CONDITION
|
392 | "${NodeJS_WIN32_DELAYLOAD_CONDITION}"
|
393 | )
|
394 | configure_file(
|
395 | ${NodeJS_MODULE_PATH}/src/win_delay_load_hook.c
|
396 | ${CMAKE_CURRENT_BINARY_DIR}/win_delay_load_hook.c @ONLY
|
397 | )
|
398 | list(APPEND NodeJS_ADDITIONAL_SOURCES
|
399 | ${CMAKE_CURRENT_BINARY_DIR}/win_delay_load_hook.c
|
400 | )
|
401 | endif()
|
402 |
|
403 |
|
404 | if(NodeJS_PLATFORM_DARWIN)
|
405 | list(APPEND NodeJS_LINK_FLAGS "-undefined dynamic_lookup")
|
406 | endif()
|
407 |
|
408 |
|
409 | if(NodeJS_USE_CLANG_STDLIB AND CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*")
|
410 | list(APPEND NodeJS_COMPILE_OPTIONS -stdlib=libc++)
|
411 | endif()
|
412 |
|
413 |
|
414 |
|
415 | if(NOT NodeJS_CXX_STANDARD)
|
416 | if(NodeJS_VERSION VERSION_GREATER NodeJS_CXX11R_VERSION)
|
417 | set(NodeJS_CXX_STANDARD 11)
|
418 | else()
|
419 | set(NodeJS_CXX_STANDARD 98)
|
420 | endif()
|
421 | endif()
|
422 |
|
423 |
|
424 | list(APPEND NodeJS_DEFINITIONS BUILDING_NODE_EXTENSION)
|
425 | if(NodeJS_PLATFORM_DARWIN)
|
426 | list(APPEND NodeJS_DEFINITIONS _DARWIN_USE_64_BIT_INODE=1)
|
427 | endif()
|
428 | if(NOT NodeJS_PLATFORM_WIN32)
|
429 | list(APPEND NodeJS_DEFINITIONS
|
430 | _LARGEFILE_SOURCE
|
431 | _FILE_OFFSET_BITS=64
|
432 | )
|
433 | endif()
|
434 |
|
435 | function(add_nodejs_module NAME)
|
436 |
|
437 | add_library(${NAME} SHARED ${ARGN} ${NodeJS_ADDITIONAL_SOURCES})
|
438 |
|
439 |
|
440 |
|
441 |
|
442 | nodejs_find_module_fallback(nan ${CMAKE_CURRENT_SOURCE_DIR} NAN_PATH)
|
443 | target_include_directories(${NAME}
|
444 | PUBLIC ${NodeJS_INCLUDE_DIRS}
|
445 | PUBLIC ${NAN_PATH}
|
446 | )
|
447 |
|
448 |
|
449 |
|
450 | get_target_property(COMPILE_OPTIONS ${NAME} COMPILE_OPTIONS)
|
451 | if(NOT COMPILE_OPTIONS)
|
452 | set(COMPILE_OPTIONS "")
|
453 | endif()
|
454 | set(COMPILE_OPTIONS ${COMPILE_OPTIONS} ${NodeJS_COMPILE_OPTIONS})
|
455 | get_target_property(LINK_FLAGS ${NAME} LINK_FLAGS)
|
456 | if(NOT LINK_FLAGS)
|
457 | set(LINK_FLAGS "")
|
458 | endif()
|
459 | foreach(NodeJS_LINK_FLAG ${NodeJS_LINK_FLAGS})
|
460 | set(LINK_FLAGS "${LINK_FLAGS} ${NodeJS_LINK_FLAG}")
|
461 | endforeach()
|
462 | set_target_properties(${NAME} PROPERTIES
|
463 | PREFIX ""
|
464 | SUFFIX ".node"
|
465 | MACOSX_RPATH ON
|
466 | POSITION_INDEPENDENT_CODE TRUE
|
467 | COMPILE_OPTIONS "${COMPILE_OPTIONS}"
|
468 | LINK_FLAGS "${LINK_FLAGS}"
|
469 | CXX_STANDARD_REQUIRED TRUE
|
470 | CXX_STANDARD ${NodeJS_CXX_STANDARD}
|
471 | )
|
472 |
|
473 |
|
474 |
|
475 |
|
476 | if(NOT CMAKE_CONFIGURATION_TYPES)
|
477 | set_property(TARGET ${NAME} PROPERTY LIBRARY_OUTPUT_DIRECTORY
|
478 | ${CMAKE_BUILD_TYPE}
|
479 | )
|
480 | endif()
|
481 |
|
482 |
|
483 |
|
484 | target_compile_definitions(${NAME} PRIVATE ${NodeJS_DEFINITIONS})
|
485 |
|
486 |
|
487 | target_link_libraries(${NAME} ${NodeJS_LIBRARIES})
|
488 | endfunction()
|
489 |
|
490 |
|
491 | configure_file(
|
492 | ${NodeJS_MODULE_PATH}/build.json.in
|
493 | ${CMAKE_CURRENT_BINARY_DIR}/build.json @ONLY
|
494 | )
|
495 |
|
496 |
|
497 | if(NodeJS_VERSION VERSION_GREATER NodeJS_CXX11R_VERSION AND
|
498 | NodeJS_CXX_STANDARD EQUAL 98)
|
499 | message(FATAL_ERROR "${NodeJS_VARIANT_NAME} ${NodeJS_VERSION} \
|
500 | requires C++11 or newer to build")
|
501 | endif()
|
502 |
|
503 |
|
504 | include(FindPackageHandleStandardArgs)
|
505 | set(NodeJS_TARGET "${NodeJS_VARIANT_NAME} ${NodeJS_PLATFORM}/${NodeJS_ARCH}")
|
506 | find_package_handle_standard_args(NodeJS
|
507 | FOUND_VAR NodeJS_FOUND
|
508 | REQUIRED_VARS NodeJS_TARGET NodeJS_INCLUDE_DIRS
|
509 | VERSION_VAR NodeJS_VERSION
|
510 | )
|
511 |
|
512 |
|
513 | mark_as_advanced(
|
514 | NodeJS_VALIDATE_EXECUTABLE
|
515 | NodeJS_OTHER_COMPONENTS
|
516 | NodeJS_COMPONENTS_CONTAINS_VARIANT
|
517 | NodeJS_COMPONENT
|
518 | NodeJS_OTHER_INDEX
|
519 | NodeJS_VERSION_STRING
|
520 | NodeJS_VERSION_MAJOR
|
521 | NodeJS_VERSION_MINOR
|
522 | NodeJS_VERSION_PATCH
|
523 | NodeJS_VERSION_TWEAK
|
524 | NodeJS_PLATFORM
|
525 | NodeJS_PLATFORM_WIN32
|
526 | NodeJS_PLATFORM_LINUX
|
527 | NodeJS_PLATFORM_DARWIN
|
528 | NodeJS_ARCH
|
529 | NodeJS_ARCH_X64
|
530 | NodeJS_ARCH_IA32
|
531 | NodeJS_ARCH_ARM
|
532 | NodeJS_DEFAULT_VARIANT_NAME
|
533 | NodeJS_VARIANT_BASE
|
534 | NodeJS_VARIANT_NAME
|
535 | NodeJS_URL
|
536 | NodeJS_SOURCE_PATH
|
537 | NodeJS_CHECKSUM_PATH
|
538 | NodeJS_CHECKSUM_TYPE
|
539 | NodeJS_WIN32_LIBRARY_PATH
|
540 | NodeJS_WIN32_BINARY_PATH
|
541 | NodeJS_WIN32_LIBRARY_NAME
|
542 | NodeJS_WIN32_BINARY_NAME
|
543 | NodeJS_DEFAULT_INCLUDE
|
544 | NodeJS_DEFAULT_LIBS
|
545 | NodeJS_HAS_WIN32_BINARY
|
546 | NodeJS_HEADER_VERSION
|
547 | NodeJS_SHA256_VERISON
|
548 | NodeJS_PREFIX_VERSION
|
549 | NodeJS_SOURCE_INCLUDE
|
550 | NodeJS_HEADER_INCLUDE
|
551 | NodeJS_INCLUDE_PATHS
|
552 | NodeJS_WIN32_DELAYLOAD
|
553 | NodeJS_DOWNLOAD_PATH
|
554 | NodeJS_CHECKSUM_FILE
|
555 | NodeJS_CHECKSUM_DATA
|
556 | NodeJS_SOURCE_FILE
|
557 | NodeJS_SOURCE_CHECKSUM
|
558 | NodeJS_HEADER_PATH
|
559 | NodeJS_HEADER_BASE
|
560 | NodeJS_INCLUDE_DIR
|
561 | NodeJS_WIN32_LIBRARY_FILE
|
562 | NodeJS_WIN32_LIBRARY_CHECKSUM
|
563 | NodeJS_WIN32_BINARY_FILE
|
564 | NodeJS_WIN32_BINARY_CHECKSUM
|
565 | NodeJS_NAN_PATH
|
566 | NodeJS_LINK_FLAGS
|
567 | NodeJS_COMPILE_OPTIONS
|
568 | NodeJS_ADDITIONAL_SOURCES
|
569 | NodeJS_WIN32_DELAYLOAD_CONDITION
|
570 | NodeJS_WIN32_DELAYLOAD_BINARY
|
571 | NodeJS_TARGET
|
572 | ) |
\ | No newline at end of file |