Trying to solve bugs with FindNodeJS.cmake.
@@ -307,28 +307,28 @@ endif()
# Find NodeJS library from module version
if(NodeJS_MODULE_VERSION)
# NodeJS library names
+ if(WIN32)
+ if(NodeJS_VERSION_MAJOR GREATER_EQUAL 14)
set(NodeJS_LIBRARY_NAMES
- libnode.so.${NodeJS_MODULE_VERSION}
- libnode.so
- libnode.${NodeJS_MODULE_VERSION}.dylib
- libnode.dylib
- )
-
- if(WIN32 AND NodeJS_VERSION_MAJOR GREATER_EQUAL 14)
- set(NodeJS_LIBRARY_NAMES
- ${NodeJS_LIBRARY_NAMES}
libnode.${NodeJS_MODULE_VERSION}.dll
libnode.dll
libnode.lib
)
else()
set(NodeJS_LIBRARY_NAMES
- ${NodeJS_LIBRARY_NAMES}
node.${NodeJS_MODULE_VERSION}.dll
node.dll
node.lib
)
endif()
+ else()
+ set(NodeJS_LIBRARY_NAMES
+ libnode.so.${NodeJS_MODULE_VERSION}
+ libnode.so
+ libnode.${NodeJS_MODULE_VERSION}.dylib
+ libnode.dylib
+ )
+ endif()
if(NOT NodeJS_BUILD_FROM_SOURCE)
message(STATUS "Searching NodeJS library version ${NodeJS_MODULE_VERSION}")
@@ -376,11 +376,19 @@ if(NOT NodeJS_LIBRARY)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar "xvf" "${NodeJS_DOWNLOAD_FILE}" WORKING_DIRECTORY "${NodeJS_BASE_PATH}" OUTPUT_QUIET)
endif()
+ if(WIN32)
if(NodeJS_VERSION_MAJOR LESS 14)
set(NodeJS_COMPILE_PATH "${NodeJS_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}")
else()
set(NodeJS_COMPILE_PATH "${NodeJS_OUTPUT_PATH}/out/${CMAKE_BUILD_TYPE}")
endif()
+ else()
+ if(NodeJS_VERSION_MAJOR LESS 14)
+ set(NodeJS_COMPILE_PATH "${NodeJS_OUTPUT_PATH}/out")
+ else()
+ set(NodeJS_COMPILE_PATH "${NodeJS_OUTPUT_PATH}/out/${CMAKE_BUILD_TYPE}")
+ endif()
+ endif()
# Compile node as a shared library if needed
if(NOT EXISTS "${NodeJS_COMPILE_PATH}")
