aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelco <Helco@users.noreply.github.com>2019-06-05 01:01:27 +0200
committerPhil Christensen <philc@microsoft.com>2019-06-04 16:01:27 -0700
commite3e495d65f954ee04a4be5d4124c293188d0dd5c (patch)
tree2d0521f8333438a67fbb27c1c87a1258eae70ba6
parentfadd52d2a86a075d8fa5d1de206323196975fce9 (diff)
downloadvcpkg-e3e495d65f954ee04a4be5d4124c293188d0dd5c.tar.gz
vcpkg-e3e495d65f954ee04a4be5d4124c293188d0dd5c.zip
[asio] Add cmake target (#6751)
* [asio] Add cmake target * [asio] Export both asio and asio::asio * [asio] Also export include dir variable
-rw-r--r--ports/asio/CMakeLists.txt33
-rw-r--r--ports/asio/CONTROL2
-rw-r--r--ports/asio/asio-config.cmake6
-rw-r--r--ports/asio/portfile.cmake22
4 files changed, 55 insertions, 8 deletions
diff --git a/ports/asio/CMakeLists.txt b/ports/asio/CMakeLists.txt
new file mode 100644
index 000000000..aa7354e76
--- /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 6ba9e4318..951c80e29 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 000000000..32e00095a
--- /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 bd5f5af2a..f9b3b739d 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}")