[duktape] Fix package not found by find_package. (#7170)

This commit is contained in:
NancyLi1013 2019-07-07 00:25:09 -07:00 committed by Phil Christensen
parent 4290df114c
commit 465990716b
4 changed files with 41 additions and 1 deletions

View File

@ -1,5 +1,5 @@
Source: duktape
Version: 2.3.0
Version: 2.3.0-1
Homepage: https://github.com/svaarala/duktape
Description: Embeddable Javascript engine with a focus on portability and compact footprint.
Build-Depends:

View File

@ -0,0 +1,33 @@
# - Try to find duktape
# Once done this will define
#
# DUKTAPE_FOUND - system has Duktape
# DUKTAPE_INCLUDE_DIRS - the Duktape include directory
# DUKTAPE_LIBRARIES - Link these to use DUKTAPE
# DUKTAPE_DEFINITIONS - Compiler switches required for using Duktape
#
find_package(PkgConfig QUIET)
pkg_check_modules(PC_DUK QUIET duktape libduktape)
find_path(DUKTAPE_INCLUDE_DIR duktape.h
HINTS ${PC_DUK_INCLUDEDIR} ${PC_DUK_INCLUDE_DIRS}
PATH_SUFFIXES duktape)
find_library(DUKTAPE_LIBRARY
NAMES duktape libduktape
HINTS ${PC_DUK_LIBDIR} ${PC_DUK_LIBRARY_DIRS})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Duktape
REQUIRED_VARS DUKTAPE_LIBRARY DUKTAPE_INCLUDE_DIR)
if (DUKTAPE_FOUND)
set (DUKTAPE_LIBRARIES ${DUKTAPE_LIBRARY})
set (DUKTAPE_INCLUDE_DIRS ${DUKTAPE_INCLUDE_DIR} )
endif ()
MARK_AS_ADVANCED(
DUKTAPE_INCLUDE_DIR
DUKTAPE_LIBRARY
)

View File

@ -13,6 +13,8 @@ vcpkg_from_github(
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/duktapeConfig.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
if(CMAKE_HOST_WIN32)
set(EXECUTABLE_SUFFIX ".exe")

5
ports/duktape/usage Normal file
View File

@ -0,0 +1,5 @@
find_package(duktape CONFIG REQUIRED)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${DUKTAPE_INCLUDE_DIRS})
target_link_libraries(main ${DUKTAPE_LIBRARY})