UNPKG

20.3 kBPlain TextView Raw
1# This script uses CMake 3.1+ features
2if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.1.0)
3 message(FATAL_ERROR "FindNodeJS.cmake uses CMake 3.1+ features")
4endif()
5
6# Force a build type to be set (ignored on config based generators)
7if(NOT CMAKE_BUILD_TYPE)
8 set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type" FORCE)
9endif()
10
11# Capture module information
12set(NodeJS_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
13get_filename_component(NodeJS_MODULE_NAME ${NodeJS_MODULE_PATH} NAME)
14
15# Allow users to specify the installed location of the Node.js package
16set(NodeJS_ROOT_DIR "" CACHE PATH
17 "The root directory of the node.js installed package")
18
19# Allow users to specify that downloaded sources should be used
20option(NodeJS_DOWNLOAD "Download the required source files" Off)
21
22# Allow users to force downloading of node packages
23option(NodeJS_FORCE_DOWNLOAD "Download the source files every time" Off)
24
25# Allow users to force archive extraction
26option(NodeJS_FORCE_EXTRACT "Extract the archive every time" Off)
27
28# Make libc++ the default when compiling with clang
29option(NodeJS_USE_CLANG_STDLIB "Use libc++ when compiling with clang" On)
30if(APPLE)
31 set(NodeJS_USE_CLANG_STDLIB On CACHE BOOL "" FORCE)
32endif()
33
34if(WIN32)
35 # Allow users to specify that the executable should be downloaded
36 option(NodeJS_DOWNLOAD_EXECUTABLE
37 "Download matching executable if available" Off
38 )
39endif()
40
41# Try to find the node.js executable
42# The node executable under linux may not be the correct program
43find_program(NodeJS_EXECUTABLE
44 NAMES node
45 PATHS ${NodeJS_ROOT_DIR}
46 PATH_SUFFIXES nodejs node
47)
48set(NodeJS_VALIDATE_EXECUTABLE 1)
49if(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 )
66endif()
67
68# If node isn't the node.js binary, try the nodejs binary
69if(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()
90endif()
91
92# Determine if a variant is set in the components
93list(APPEND NodeJS_OTHER_COMPONENTS
94 X64 IA32 ARM WIN32 LINUX DARWIN
95)
96set(NodeJS_COMPONENTS_CONTAINS_VARIANT False)
97foreach(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()
103endforeach()
104
105# Get the targeted version of Node.js (or one of its derivatives)
106if(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()
116endif()
117
118# Determine the target platform for the compiled module
119# Uses several mechanisms in order:
120#
121# 1. CMake cache (allows overriding on the command line)
122# 2. Node architecture when binary is available
123# 3. CMake architecture
124#
125set(NodeJS_PLATFORM "" CACHE STRING "Target node.js platform for module")
126if(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()
142endif()
143
144# Convenience variables for the platform type
145if(NodeJS_PLATFORM STREQUAL "win32")
146 set(NodeJS_PLATFORM_WIN32 True)
147 set(NodeJS_PLATFORM_LINUX False)
148 set(NodeJS_PLATFORM_DARWIN False)
149elseif(NodeJS_PLATFORM STREQUAL "linux")
150 set(NodeJS_PLATFORM_WIN32 False)
151 set(NodeJS_PLATFORM_LINUX True)
152 set(NodeJS_PLATFORM_DARWIN False)
153elseif(NodeJS_PLATFORM STREQUAL "darwin")
154 set(NodeJS_PLATFORM_WIN32 False)
155 set(NodeJS_PLATFORM_LINUX False)
156 set(NodeJS_PLATFORM_DARWIN True)
157endif()
158
159# Determine the target architecture for the compiled module
160# Uses several mechanisms in order:
161#
162# 1. CMake cache (allows overriding on the command line)
163# 2. Node architecture when binary is available
164# 3. Compiler architecture under MSVC
165#
166set(NodeJS_ARCH "" CACHE STRING "Target node.js architecture for module")
167if(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()
181endif()
182
183# Convenience variables for the architecture
184if(NodeJS_ARCH STREQUAL "x64")
185 set(NodeJS_ARCH_X64 True)
186 set(NodeJS_ARCH_IA32 False)
187 set(NodeJS_ARCH_ARM False)
188elseif(NodeJS_ARCH STREQUAL "ia32")
189 set(NodeJS_ARCH_X64 False)
190 set(NodeJS_ARCH_IA32 True)
191 set(NodeJS_ARCH_ARM False)
192elseif(NodeJS_ARCH STREQUAL "arm")
193 set(NodeJS_ARCH_X64 False)
194 set(NodeJS_ARCH_IA32 False)
195 set(NodeJS_ARCH_ARM True)
196endif()
197
198# Include helper functions
199include(util/NodeJSUtil)
200
201# Default variant name
202# Used by the installed header comparison below
203set(NodeJS_DEFAULT_VARIANT_NAME "node.js")
204
205# Variables for Node.js artifacts across variants
206# Specify all of these variables for each new variant
207set(NodeJS_VARIANT_NAME "") # The printable name of the variant
208set(NodeJS_VARIANT_BASE "") # A file name safe version of the variant
209set(NodeJS_URL "") # The URL for the artifacts
210set(NodeJS_SOURCE_PATH "") # The URL path of the source archive
211set(NodeJS_CHECKSUM_PATH "") # The URL path of the checksum file
212set(NodeJS_CHECKSUM_TYPE "") # The checksum type (algorithm)
213set(NodeJS_WIN32_LIBRARY_PATH "") # The URL path of the windows library
214set(NodeJS_WIN32_BINARY_PATH "") # The URL path of the windows executable
215set(NodeJS_WIN32_LIBRARY_NAME "") # The name of the windows library
216set(NodeJS_WIN32_BINARY_NAME "") # The name of the windows executable
217
218set(NodeJS_DEFAULT_INCLUDE True) # Enable default include behavior
219set(NodeJS_DEFAULT_LIBS True) # Include the default libraries
220set(NodeJS_HAS_WIN32_PREFIX True) # Does the variant use library prefixes
221set(NodeJS_HAS_WIN32_BINARY True) # Does the variant have win32 executables
222set(NodeJS_HAS_OPENSSL True) # Does the variant include openssl headers
223set(NodeJS_HEADER_VERSION 0.12.7) # Version after header-only archives start
224set(NodeJS_SHA256_VERSION 0.7.0) # Version after sha256 checksums start
225set(NodeJS_PREFIX_VERSION 0.12.7) # Version after windows prefixing starts
226set(NodeJS_CXX11R_VERSION 0.12.7) # Version after c++11 is required
227set(NodeJS_SOURCE_INCLUDE True) # Use the include paths from a source archive
228set(NodeJS_HEADER_INCLUDE False) # Use the include paths from a header archive
229set(NodeJS_INCLUDE_PATHS "") # Set of header dirs inside the source archive
230set(NodeJS_LIBRARIES "") # The set of libraries to link with addon
231set(NodeJS_WIN32_DELAYLOAD "") # Set of executables to delayload on windows
232
233# NodeJS variants
234# Selects download target based on configured component
235# Include NodeJS last to provide default configurations when omitted
236file(
237 GLOB NodeJS_SUPPORTED_VARIANTS
238 RELATIVE ${CMAKE_CURRENT_LIST_DIR}/variants
239 ${CMAKE_CURRENT_LIST_DIR}/variants/*
240)
241foreach(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()
248endforeach()
249include(variants/NodeJS)
250
251# Populate version variables, including version components
252set(NodeJS_VERSION_STRING "v${NodeJS_VERSION}")
253
254# Populate the remaining version variables
255string(REPLACE "." ";" NodeJS_VERSION_PARTS ${NodeJS_VERSION})
256list(GET NodeJS_VERSION_PARTS 0 NodeJS_VERSION_MAJOR)
257list(GET NodeJS_VERSION_PARTS 1 NodeJS_VERSION_MINOR)
258list(GET NodeJS_VERSION_PARTS 2 NodeJS_VERSION_PATCH)
259
260# If the version we're looking for is the version that is installed,
261# try finding the required headers. Don't do this under windows (where
262# headers are not part of the installed content), when the user has
263# specified that headers should be downloaded or when using a variant other
264# than the default
265if((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 # node.h is really generic and too easy for cmake to find the wrong
271 # file, so use the directory as a guard, and then just tack it on to
272 # the actual path
273 #
274 # Specifically ran into this under OSX, where python contains a node.h
275 # that gets found instead
276 find_path(NodeJS_INCLUDE_PARENT node/node.h)
277 set(NodeJS_INCLUDE_DIRS ${NodeJS_INCLUDE_PARENT}/node)
278
279 # Under all systems that support this, there are no libraries required
280 # for linking (symbols are resolved via the main executable at runtime)
281 set(NodeJS_LIBRARIES "")
282
283# Otherwise, headers and required libraries must be downloaded to the project
284# to supplement what is installed
285else()
286 # Create a folder for downloaded artifacts
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 # Download the checksum file for validating all other downloads
294 # Conveniently, if this doesn't download correctly, the setup fails
295 # due to checksum failures
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 # Download and extract the main source archive
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 # Populate include directories from the extracted source archive
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 # Download required library files when targeting windows
333 if(NodeJS_PLATFORM_WIN32)
334 # Download the windows library
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 # If provided, download the windows executable
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()
376endif()
377
378# Support windows delay loading
379if(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 )
401endif()
402
403# Allow undefined symbols on OSX
404if(NodeJS_PLATFORM_DARWIN)
405 list(APPEND NodeJS_LINK_FLAGS "-undefined dynamic_lookup")
406endif()
407
408# Use libc++ when clang is the compiler by default
409if(NodeJS_USE_CLANG_STDLIB AND CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*")
410 list(APPEND NodeJS_COMPILE_OPTIONS -stdlib=libc++)
411endif()
412
413# Require c++11 support after a specific point, but only if the user hasn't
414# specified an override
415if(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()
421endif()
422
423# Set required definitions
424list(APPEND NodeJS_DEFINITIONS BUILDING_NODE_EXTENSION)
425if(NodeJS_PLATFORM_DARWIN)
426 list(APPEND NodeJS_DEFINITIONS _DARWIN_USE_64_BIT_INODE=1)
427endif()
428if(NOT NodeJS_PLATFORM_WIN32)
429 list(APPEND NodeJS_DEFINITIONS
430 _LARGEFILE_SOURCE
431 _FILE_OFFSET_BITS=64
432 )
433endif()
434
435function(add_nodejs_module NAME)
436 # Build a shared library for the module
437 add_library(${NAME} SHARED ${ARGN} ${NodeJS_ADDITIONAL_SOURCES})
438
439 # Include required headers
440 # Find and include Nan as well (always available as its a
441 # dependency of this module)
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 # Set module properties
449 # This ensures proper naming of the module library across all platforms
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 # Output the module in a per build type directory
474 # This makes builds consistent with visual studio and other generators
475 # that build by configuration
476 if(NOT CMAKE_CONFIGURATION_TYPES)
477 set_property(TARGET ${NAME} PROPERTY LIBRARY_OUTPUT_DIRECTORY
478 ${CMAKE_BUILD_TYPE}
479 )
480 endif()
481
482 # Set any required complier flags
483 # Mostly used under windows
484 target_compile_definitions(${NAME} PRIVATE ${NodeJS_DEFINITIONS})
485
486 # Link against required NodeJS libraries
487 target_link_libraries(${NAME} ${NodeJS_LIBRARIES})
488endfunction()
489
490# Write out the configuration for node scripts
491configure_file(
492 ${NodeJS_MODULE_PATH}/build.json.in
493 ${CMAKE_CURRENT_BINARY_DIR}/build.json @ONLY
494)
495
496# Make sure we haven't violated the version-to-standard mapping
497if(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")
501endif()
502
503# This is a find_package file, handle the standard invocation
504include(FindPackageHandleStandardArgs)
505set(NodeJS_TARGET "${NodeJS_VARIANT_NAME} ${NodeJS_PLATFORM}/${NodeJS_ARCH}")
506find_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# Mark variables that users shouldn't modify
513mark_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