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