diff options
| author | Nicolai Grodzitski <utromvecherom@gmail.com> | 2018-04-27 00:51:13 +0300 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2018-04-26 14:51:13 -0700 |
| commit | 8a624f93b7a3915616396b2f958c17b04bec45a3 (patch) | |
| tree | 02c40cd31cb72fd4f78f916b581b225abc35ac3d | |
| parent | ef594607829ad6ed2bd462a0ddcbb0ee698b3f4f (diff) | |
| download | vcpkg-8a624f93b7a3915616396b2f958c17b04bec45a3.tar.gz vcpkg-8a624f93b7a3915616396b2f958c17b04bec45a3.zip | |
Improve cmake routine for nodejs/http-parser. (#3283)
* Improve cmake routine for nodejs/http-parser. Now it is installed as a
propper target and can be searched with `find_package(http-parser REQUIRED)` and then used as
a dependency like this: `target_link_libraries(main PRIVATE
nodejs::http_parser)`. Also using namespace for referencing http-parser
lib, which is safer, although the old name must still work, as names of
the binaries remained unchanged.
* Remove duplicate variable definition and add newlines at the end of files.
* [http-parser] Rename exported targets to "unofficial", since they are not blessed by upstream
| -rw-r--r-- | ports/http-parser/CMakeLists.txt | 30 | ||||
| -rw-r--r-- | ports/http-parser/CONTROL | 2 | ||||
| -rw-r--r-- | ports/http-parser/portfile.cmake | 28 |
3 files changed, 33 insertions, 27 deletions
diff --git a/ports/http-parser/CMakeLists.txt b/ports/http-parser/CMakeLists.txt index d959fff79..284c8e903 100644 --- a/ports/http-parser/CMakeLists.txt +++ b/ports/http-parser/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required (VERSION 3.4) -project (http-parser) +cmake_minimum_required(VERSION 3.4) +project(http-parser C) -if (BUILD_SHARED_LIBS) - SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +if(BUILD_SHARED_LIBS) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() if(CMAKE_BUILD_TYPE MATCHES "Release") @@ -11,11 +11,21 @@ endif() add_library(http_parser http_parser.c http_parser.h) -install(TARGETS http_parser - RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" - ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" +target_include_directories(http_parser PUBLIC $<INSTALL_INTERFACE:include>) + +install( + TARGETS http_parser + EXPORT NODEJS_HTTP_PARSER_ALL_TARGETS + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin +) + +install( + EXPORT NODEJS_HTTP_PARSER_ALL_TARGETS + NAMESPACE unofficial::http_parser:: + FILE unofficial-http-parser-config.cmake + DESTINATION share/unofficial-http-parser ) -if (NOT SKIP_INSTALL_HEADERS) - install(FILES http_parser.h DESTINATION "${CMAKE_INSTALL_PREFIX}/include") -endif()
\ No newline at end of file +install(FILES http_parser.h DESTINATION include) diff --git a/ports/http-parser/CONTROL b/ports/http-parser/CONTROL index a9edf4071..26b9f8d34 100644 --- a/ports/http-parser/CONTROL +++ b/ports/http-parser/CONTROL @@ -1,3 +1,3 @@ Source: http-parser -Version: 2.7.1-2 +Version: 2.7.1-3 Description: HTTP Parser. diff --git a/ports/http-parser/portfile.cmake b/ports/http-parser/portfile.cmake index 728293eed..49f829a53 100644 --- a/ports/http-parser/portfile.cmake +++ b/ports/http-parser/portfile.cmake @@ -1,29 +1,25 @@ -# Common Ambient Variables: -# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg> -# TARGET_TRIPLET is the current triplet (x86-windows, etc) -# PORT is the current port name (zlib, etc) -# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} -# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} -# include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/http-parser-2.7.1) -vcpkg_download_distfile(ARCHIVE_FILE - URLS "https://github.com/nodejs/http-parser/archive/v2.7.1.zip" - FILENAME "http-parser-2.7.1.zip" - SHA512 9fb8b855ba7edb47628c91ac062d7ffce9c4bb8d6b8237d861d7926af989fb3e354c113821bdab1b8ac910f5f1064ca1339947aa20d56f6806b919b0cd6b6eae +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO nodejs/http-parser + REF v2.7.1 + SHA512 c0fe86455db1a563a5c668f118dfa9a27b9a637ee1c0e2f2f18a5b816352436ed90435ea978e3f3d85b037d3c630234e47d609dc3b7086b898286c4e54d9f031 + HEAD_REF master ) -vcpkg_extract_source_archive(${ARCHIVE_FILE}) + file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} - OPTIONS_DEBUG - -DSKIP_INSTALL_HEADERS=ON + PREFER_NINJA ) vcpkg_install_cmake() vcpkg_copy_pdbs() +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +vcpkg_fixup_cmake_targets(CONFIG_PATH "share/unofficial-http-parser" TARGET_PATH "share/unofficial-http-parser") + # Handle copyright file(COPY ${SOURCE_PATH}/LICENSE-MIT DESTINATION ${CURRENT_PACKAGES_DIR}/share/http-parser) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/http-parser/LICENSE-MIT ${CURRENT_PACKAGES_DIR}/share/http-parser/copyright)
\ No newline at end of file +file(RENAME ${CURRENT_PACKAGES_DIR}/share/http-parser/LICENSE-MIT ${CURRENT_PACKAGES_DIR}/share/http-parser/copyright) |
