diff --git a/ports/asio/CMakeLists.txt b/ports/asio/CMakeLists.txt new file mode 100644 index 00000000000000..aa7354e7637698 --- /dev/null +++ b/ports/asio/CMakeLists.txt @@ -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/ +) diff --git a/ports/asio/CONTROL b/ports/asio/CONTROL index 6ba9e43181ff3d..951c80e29ae7cd 100644 --- a/ports/asio/CONTROL +++ b/ports/asio/CONTROL @@ -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. diff --git a/ports/asio/asio-config.cmake b/ports/asio/asio-config.cmake new file mode 100644 index 00000000000000..32e00095a77fb9 --- /dev/null +++ b/ports/asio/asio-config.cmake @@ -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}") diff --git a/ports/asio/portfile.cmake b/ports/asio/portfile.cmake index bd5f5af2a131ee..f9b3b739d5f053 100644 --- a/ports/asio/portfile.cmake +++ b/ports/asio/portfile.cmake @@ -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}")