vcpkg/ports/node-api/unofficial-node-api-config.cmake.in
Leonid Pospelov baa9d834e7
[node-api|node-addon-api] fix and update (#29599)
* node-api-config-fix

* port-ver

* upd

* hash

* newver

* add-ver

* .

* .

* respect vcpkg_build_type in config

* addver

* Update node-addon-api.json
2023-02-14 10:27:11 -08:00

39 lines
1.4 KiB
CMake

if(NOT TARGET unofficial::node-api::node-api)
if(WIN32)
add_library(unofficial::node-api::node-api UNKNOWN IMPORTED)
else()
add_library(unofficial::node-api::node-api INTERFACE IMPORTED)
endif()
find_path(node-api_INCLUDE_DIR
NAMES node.h
PATHS "${CMAKE_CURRENT_LIST_DIR}/../../include/node"
NO_DEFAULT_PATH
REQUIRED
)
set_target_properties(unofficial::node-api::node-api PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${node-api_INCLUDE_DIR}"
)
if(APPLE)
set_target_properties(unofficial::node-api::node-api PROPERTIES
INTERFACE_LINK_OPTIONS "LINKER:SHELL:-undefined dynamic_lookup"
)
endif()
if(WIN32)
find_library(node-api_LIBRARY_RELEASE NAMES node PATHS "${CMAKE_CURRENT_LIST_DIR}/../../lib" NO_DEFAULT_PATH REQUIRED)
set_target_properties(unofficial::node-api::node-api PROPERTIES
IMPORTED_LOCATION_RELEASE "${node-api_LIBRARY_RELEASE}"
IMPORTED_CONFIGURATIONS RELEASE
)
if("@VCPKG_BUILD_TYPE@" STREQUAL "")
find_library(node-api_LIBRARY_DEBUG NAMES node PATHS "${CMAKE_CURRENT_LIST_DIR}/../../debug/lib" NO_DEFAULT_PATH REQUIRED)
set_target_properties(unofficial::node-api::node-api PROPERTIES
IMPORTED_LOCATION_DEBUG "${node-api_LIBRARY_DEBUG}"
)
set_property(TARGET unofficial::node-api::node-api APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
endif()
endif()
endif()