UNPKG

20.4 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
28if(WIN32)
29 # Allow users to specify that the executable should be downloaded
30 option(NodeJS_DOWNLOAD_EXECUTABLE
31 "Download matching executable if available" Off
32 )
33endif()
34
35# Try to find the node.js executable
36# The node executable under linux may not be the correct program
37find_program(NodeJS_EXECUTABLE
38 NAMES node
39 PATHS ${NodeJS_ROOT_DIR}
40 PATH_SUFFIXES nodejs node
41)
42set(NodeJS_VALIDATE_EXECUTABLE 1)
43if(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 )
60endif()
61
62# If node isn't the node.js binary, try the nodejs binary
63if(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()
84endif()
85
86# Determine if a variant is set in the components
87list(APPEND NodeJS_OTHER_COMPONENTS
88 X64 IA32 ARM WIN32 LINUX DARWIN
89)
90set(NodeJS_COMPONENTS_CONTAINS_VARIANT False)
91foreach(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()
97endforeach()
98
99# Get the targeted version of Node.js (or one of its derivatives)
100if(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()
110endif()
111
112# Determine the target platform for the compiled module
113# Uses several mechanisms in order:
114#
115# 1. CMake cache (allows overriding on the command line)
116# 2. Component specification (set when calling find_package)
117# 3. Node architecture when binary is available
118# 4. CMake architecture
119#
120set(NodeJS_PLATFORM "" CACHE STRING "Target node.js platform for module")
121if(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()
143endif()
144
145# Convenience variables for the platform type
146if(NodeJS_PLATFORM STREQUAL "win32")
147 set(NodeJS_PLATFORM_WIN32 True)
148 set(NodeJS_PLATFORM_LINUX False)
149 set(NodeJS_PLATFORM_DARWIN False)
150elseif(NodeJS_PLATFORM STREQUAL "linux")
151 set(NodeJS_PLATFORM_WIN32 False)
152 set(NodeJS_PLATFORM_LINUX True)
153 set(NodeJS_PLATFORM_DARWIN False)
154elseif(NodeJS_PLATFORM STREQUAL "darwin")
155 set(NodeJS_PLATFORM_WIN32 False)
156 set(NodeJS_PLATFORM_LINUX False)
157 set(NodeJS_PLATFORM_DARWIN True)
158endif()
159
160# Determine the target architecture for the compiled module
161# Uses several mechanisms in order:
162#
163# 1. CMake cache (allows overriding on the command line)
164# 2. Component specification (set when calling find_package)
165# 3. Node architecture when binary is available
166# 4. Compiler architecture under MSVC
167#
168set(NodeJS_ARCH "" CACHE STRING "Target node.js architecture for module")
169if(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()
192endif()
193
194# Convenience variables for the architecture
195if(NodeJS_ARCH STREQUAL "x64")
196 set(NodeJS_ARCH_X64 True)
197 set(NodeJS_ARCH_IA32 False)
198 set(NodeJS_ARCH_ARM False)
199elseif(NodeJS_ARCH STREQUAL "ia32")
200 set(NodeJS_ARCH_X64 False)
201 set(NodeJS_ARCH_IA32 True)
202 set(NodeJS_ARCH_ARM False)
203elseif(NodeJS_ARCH STREQUAL "arm")
204 set(NodeJS_ARCH_X64 False)
205 set(NodeJS_ARCH_IA32 False)
206 set(NodeJS_ARCH_ARM True)
207endif()
208
209# Include helper functions
210include(util/NodeJSUtil)
211
212# Default variant name
213# Used by the installed header comparison below
214set(NodeJS_DEFAULT_VARIANT_NAME "node.js")
215
216# Variables for Node.js artifacts across variants
217# Specify all of these variables for each new variant
218set(NodeJS_VARIANT_NAME "") # The printable name of the variant
219set(NodeJS_VARIANT_BASE "") # A file name safe version of the variant
220set(NodeJS_URL "") # The URL for the artifacts
221set(NodeJS_SOURCE_PATH "") # The URL path of the source archive
222set(NodeJS_CHECKSUM_PATH "") # The URL path of the checksum file
223set(NodeJS_CHECKSUM_TYPE "") # The checksum type (algorithm)
224set(NodeJS_WIN32_LIBRARY_PATH "") # The URL path of the windows library
225set(NodeJS_WIN32_BINARY_PATH "") # The URL path of the windows executable
226set(NodeJS_WIN32_LIBRARY_NAME "") # The name of the windows library
227set(NodeJS_WIN32_BINARY_NAME "") # The name of the windows executable
228
229set(NodeJS_DEFAULT_INCLUDE True) # Enable default include behavior
230set(NodeJS_DEFAULT_LIBS True) # Include the default libraries
231set(NodeJS_HAS_WIN32_PREFIX True) # Does the variant use library prefixes
232set(NodeJS_HAS_WIN32_BINARY True) # Does the variant have win32 executables
233set(NodeJS_HAS_OPENSSL True) # Does the variant include openssl headers
234set(NodeJS_HEADER_VERSION 0.12.7) # Version after header-only archives start
235set(NodeJS_SHA256_VERSION 0.7.0) # Version after sha256 checksums start
236set(NodeJS_PREFIX_VERSION 0.12.7) # Version after windows prefixing starts
237set(NodeJS_CXX11R_VERSION 0.12.7) # Version after c++11 is required
238set(NodeJS_SOURCE_INCLUDE True) # Use the include paths from a source archive
239set(NodeJS_HEADER_INCLUDE False) # Use the include paths from a header archive
240set(NodeJS_INCLUDE_PATHS "") # Set of header dirs inside the source archive
241set(NodeJS_LIBRARIES "") # The set of libraries to link with addon
242set(NodeJS_WIN32_DELAYLOAD "") # Set of executables to delayload on windows
243
244# NodeJS variants
245# Selects download target based on configured component
246# Include NodeJS last to provide default configurations when omitted
247file(
248 GLOB NodeJS_SUPPORTED_VARIANTS
249 RELATIVE ${CMAKE_CURRENT_LIST_DIR}/variants
250 ${CMAKE_CURRENT_LIST_DIR}/variants/*
251)
252foreach(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()
259endforeach()
260include(variants/NodeJS)
261
262# Populate version variables, including version components
263set(NodeJS_VERSION_STRING "v${NodeJS_VERSION}")
264
265# Populate the remaining version variables
266string(REPLACE "." ";" NodeJS_VERSION_PARTS ${NodeJS_VERSION})
267list(GET NodeJS_VERSION_PARTS 0 NodeJS_VERSION_MAJOR)
268list(GET NodeJS_VERSION_PARTS 1 NodeJS_VERSION_MINOR)
269list(GET NodeJS_VERSION_PARTS 2 NodeJS_VERSION_PATCH)
270
271# If the version we're looking for is the version that is installed,
272# try finding the required headers. Don't do this under windows (where
273# headers are not part of the installed content), when the user has
274# specified that headers should be downloaded or when using a variant other
275# than the default
276if((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 # node.h is really generic and too easy for cmake to find the wrong
282 # file, so use the directory as a guard, and then just tack it on to
283 # the actual path
284 #
285 # Specifically ran into this under OSX, where python contains a node.h
286 # that gets found instead
287 find_path(NodeJS_INCLUDE_PARENT node/node.h)
288 set(NodeJS_INCLUDE_DIRS ${NodeJS_INCLUDE_PARENT}/node)
289
290 # Under all systems that support this, there are no libraries required
291 # for linking (symbols are resolved via the main executable at runtime)
292 set(NodeJS_LIBRARIES "")
293
294# Otherwise, headers and required libraries must be downloaded to the project
295# to supplement what is installed
296else()
297 # Create a folder for downloaded artifacts
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 # Download the checksum file for validating all other downloads
305 # Conveniently, if this doesn't download correctly, the setup fails
306 # due to checksum failures
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 # Download and extract the main source archive
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 # Populate include directories from the extracted source archive
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 # Download required library files when targeting windows
344 if(NodeJS_PLATFORM_WIN32)
345 # Download the windows library
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 # If provided, download the windows executable
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()
387endif()
388
389# Support windows delay loading
390if(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 )
412endif()
413
414# Allow undefined symbols on OSX
415if(NodeJS_PLATFORM_DARWIN)
416 list(APPEND NodeJS_LINK_FLAGS "-undefined dynamic_lookup")
417endif()
418
419# Use libc++ when clang is the compiler
420if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*")
421 list(APPEND NodeJS_COMPILE_OPTIONS -stdlib=libc++)
422endif()
423
424# Require c++11 support after a specific point, but only if the user hasn't
425# specified an override
426if(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()
432endif()
433
434# Set required definitions
435list(APPEND NodeJS_DEFINITIONS BUILDING_NODE_EXTENSION)
436if(NodeJS_PLATFORM_DARWIN)
437 list(APPEND NodeJS_DEFINITIONS _DARWIN_USE_64_BIT_INODE=1)
438endif()
439if(NOT NodeJS_PLATFORM_WIN32)
440 list(APPEND NodeJS_DEFINITIONS
441 _LARGEFILE_SOURCE
442 _FILE_OFFSET_BITS=64
443 )
444endif()
445
446function(add_nodejs_module NAME)
447 # Build a shared library for the module
448 add_library(${NAME} SHARED ${ARGN} ${NodeJS_ADDITIONAL_SOURCES})
449
450 # Include required headers
451 # Find and include Nan as well (always available as its a
452 # dependency of this module)
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 # Set module properties
460 # This ensures proper naming of the module library across all platforms
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 # Output the module in a per build type directory
483 # This makes builds consistent with visual studio and other generators
484 # that build by configuration
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})
492endfunction()
493
494# Write out the configuration for node scripts
495configure_file(
496 ${NodeJS_MODULE_PATH}/build.json.in
497 ${CMAKE_CURRENT_BINARY_DIR}/build.json @ONLY
498)
499
500# Make sure we haven't violated the version-to-standard mapping
501if(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")
505endif()
506
507# This is a find_package file, handle the standard invocation
508include(FindPackageHandleStandardArgs)
509set(NodeJS_TARGET "${NodeJS_VARIANT_NAME} ${NodeJS_PLATFORM}/${NodeJS_ARCH}")
510find_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# Mark variables that users shouldn't modify
517mark_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