aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>2019-07-07 00:25:09 -0700
committerPhil Christensen <philc@microsoft.com>2019-07-07 00:25:09 -0700
commit465990716b0c0c6c9ad569c80caac7b3a6df36c8 (patch)
tree69239aeda1b23a26c87c81b1d8664276c28f686f
parent4290df114cf91c72e0a3ed06f436716ce233621a (diff)
downloadvcpkg-465990716b0c0c6c9ad569c80caac7b3a6df36c8.tar.gz
vcpkg-465990716b0c0c6c9ad569c80caac7b3a6df36c8.zip
[duktape] Fix package not found by find_package. (#7170)
-rw-r--r--ports/duktape/CONTROL2
-rw-r--r--ports/duktape/duktapeConfig.cmake33
-rw-r--r--ports/duktape/portfile.cmake2
-rw-r--r--ports/duktape/usage5
4 files changed, 41 insertions, 1 deletions
diff --git a/ports/duktape/CONTROL b/ports/duktape/CONTROL
index 007025398..5f212d705 100644
--- a/ports/duktape/CONTROL
+++ b/ports/duktape/CONTROL
@@ -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:
diff --git a/ports/duktape/duktapeConfig.cmake b/ports/duktape/duktapeConfig.cmake
new file mode 100644
index 000000000..56d7798fd
--- /dev/null
+++ b/ports/duktape/duktapeConfig.cmake
@@ -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
+) \ No newline at end of file
diff --git a/ports/duktape/portfile.cmake b/ports/duktape/portfile.cmake
index ef1476a52..e15ca137b 100644
--- a/ports/duktape/portfile.cmake
+++ b/ports/duktape/portfile.cmake
@@ -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")
diff --git a/ports/duktape/usage b/ports/duktape/usage
new file mode 100644
index 000000000..5870cb2bb
--- /dev/null
+++ b/ports/duktape/usage
@@ -0,0 +1,5 @@
+find_package(duktape CONFIG REQUIRED)
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${DUKTAPE_INCLUDE_DIRS})
+
+target_link_libraries(main ${DUKTAPE_LIBRARY}) \ No newline at end of file