mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-06-07 12:57:20 +08:00
[asio] Add cmake target (#6751)
* [asio] Add cmake target * [asio] Export both asio and asio::asio * [asio] Also export include dir variable
This commit is contained in:
parent
fadd52d2a8
commit
e3e495d65f
33
ports/asio/CMakeLists.txt
Normal file
33
ports/asio/CMakeLists.txt
Normal file
@ -0,0 +1,33 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
project(asio)
|
||||
|
||||
add_library(asio INTERFACE)
|
||||
|
||||
# Always use "ASIO_STANDALONE" to avoid boost dependency
|
||||
file(READ "asio/include/asio/detail/config.hpp" _contents)
|
||||
string(REPLACE "defined(ASIO_STANDALONE)" "!defined(VCPKG_DISABLE_ASIO_STANDALONE)" _contents "${_contents}")
|
||||
file(WRITE "asio/include/asio/detail/config.hpp" "${_contents}")
|
||||
|
||||
# Export target
|
||||
install(TARGETS asio
|
||||
EXPORT asio
|
||||
INCLUDES DESTINATION include/
|
||||
)
|
||||
|
||||
install(EXPORT asio
|
||||
DESTINATION "share/asio"
|
||||
FILE asio-targets.cmake
|
||||
)
|
||||
|
||||
install(DIRECTORY
|
||||
asio/include/asio
|
||||
DESTINATION include/
|
||||
FILES_MATCHING
|
||||
PATTERN "*.hpp"
|
||||
PATTERN "*.ipp"
|
||||
)
|
||||
|
||||
install(FILES
|
||||
asio/include/asio.hpp
|
||||
DESTINATION include/
|
||||
)
|
@ -1,3 +1,3 @@
|
||||
Source: asio
|
||||
Version: 1.12.2
|
||||
Version: 1.12.2-1
|
||||
Description: Asio is a cross-platform C++ library for network and low-level I/O programming that provides developers with a consistent asynchronous model using a modern C++ approach.
|
||||
|
6
ports/asio/asio-config.cmake
Normal file
6
ports/asio/asio-config.cmake
Normal file
@ -0,0 +1,6 @@
|
||||
include ("${CMAKE_CURRENT_LIST_DIR}/asio-targets.cmake")
|
||||
add_library(asio::asio INTERFACE IMPORTED)
|
||||
target_link_libraries(asio::asio INTERFACE asio)
|
||||
|
||||
get_target_property(_ASIO_INCLUDE_DIR asio INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(ASIO_INCLUDE_DIR "${_ASIO_INCLUDE_DIR}")
|
@ -9,13 +9,21 @@ vcpkg_from_github(
|
||||
HEAD_REF master
|
||||
)
|
||||
|
||||
# CMake install
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
)
|
||||
vcpkg_install_cmake()
|
||||
|
||||
vcpkg_fixup_cmake_targets(CONFIG_PATH "share/asio")
|
||||
file(INSTALL
|
||||
${CMAKE_CURRENT_LIST_DIR}/asio-config.cmake
|
||||
DESTINATION ${CURRENT_PACKAGES_DIR}/share/asio/
|
||||
)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug)
|
||||
|
||||
# Handle copyright
|
||||
file(INSTALL ${SOURCE_PATH}/asio/LICENSE_1_0.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
||||
|
||||
# Copy the asio header files
|
||||
file(INSTALL ${SOURCE_PATH}/asio/include DESTINATION ${CURRENT_PACKAGES_DIR} FILES_MATCHING PATTERN "*.hpp" PATTERN "*.ipp")
|
||||
|
||||
# Always use "ASIO_STANDALONE" to avoid boost dependency
|
||||
file(READ "${CURRENT_PACKAGES_DIR}/include/asio/detail/config.hpp" _contents)
|
||||
string(REPLACE "defined(ASIO_STANDALONE)" "!defined(VCPKG_DISABLE_ASIO_STANDALONE)" _contents "${_contents}")
|
||||
file(WRITE "${CURRENT_PACKAGES_DIR}/include/asio/detail/config.hpp" "${_contents}")
|
||||
|
Loading…
Reference in New Issue
Block a user