Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jul 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ports/duktape/CONTROL
Original file line number Diff line number Diff line change
@@ -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:
33 changes: 33 additions & 0 deletions ports/duktape/duktapeConfig.cmake
Original file line number Diff line number Diff line change
@@ -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
)
2 changes: 2 additions & 0 deletions ports/duktape/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
5 changes: 5 additions & 0 deletions ports/duktape/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
find_package(duktape CONFIG REQUIRED)

include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${DUKTAPE_INCLUDE_DIRS})

target_link_libraries(main ${DUKTAPE_LIBRARY})