Solve bug in NodeJS Addon API.
# NODEJS_ADDON_API_INCLUDE_DIR - NodeJS Addon API headers path
# Prevent vervosity if already included
-if(NODEJS_ADDON_API_INCLUDE_DIR)
+if(NODEJS_ADDON_API_FOUND)
set(NODEJS_ADDON_API_FIND_QUIETLY TRUE)
endif()
+set(NODEJS_ADDON_API_INCLUDE_DIR "" CACHE PATH "NodeJS Addon API headers path")
+
# Include package manager
include(FindPackageHandleStandardArgs)
@@ -26,6 +28,7 @@ if(NOT NODEJS_FOUND)
endif()
# Get the includes
+if(NODEJS_ADDON_API_INCLUDE_DIR STREQUAL "")
execute_process(
COMMAND ${NODEJS_EXECUTABLE} -p "require('node-addon-api').include"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
@@ -40,6 +43,7 @@ endif()
string(REPLACE "\n" "" NODEJS_ADDON_API_INCLUDE_DIR ${NODEJS_ADDON_API_INCLUDE_DIR})
string(REPLACE "\"" "" NODEJS_ADDON_API_INCLUDE_DIR ${NODEJS_ADDON_API_INCLUDE_DIR})
+endif()
find_package_handle_standard_args(NODEJS_ADDON_API
REQUIRED_VARS NODEJS_ADDON_API_INCLUDE_DIR
