Skip to content

Commit

Permalink
[libuv] fix for cmake target (#4803)
Browse files Browse the repository at this point in the history
* [libuv] fix for cmake target

* [libuv] rename target to unofficial-libuv
  • Loading branch information
ivysnow authored and ras0219-msft committed Dec 18, 2018
1 parent 4c6cd02 commit ac1bed3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ports/libuv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ else() # Assume some Linux variant
add_library(libuv ${UV_SOURCES_COMMON} ${UV_SOURCES_UNIX} ${UV_SOURCES_LINUX})
endif()

target_include_directories(libuv PUBLIC ./include PRIVATE ./src)
target_include_directories(libuv PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>)
set_target_properties(libuv PROPERTIES DEFINE_SYMBOL BUILDING_UV_SHARED)

if(NOT UV_SKIP_HEADERS)
Expand All @@ -71,7 +71,9 @@ if(NOT UV_SKIP_HEADERS)
endif()

install(TARGETS libuv
EXPORT libuv
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
install(EXPORT libuv FILE unofficial-libuv-targets.cmake NAMESPACE unofficial::libuv:: DESTINATION share/unofficial-libuv)
2 changes: 1 addition & 1 deletion ports/libuv/CONTROL
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Source: libuv
Version: 1.24.0
Version: 1.24.0-1
Description: libuv is a multi-platform support library with a focus on asynchronous I/O.
7 changes: 7 additions & 0 deletions ports/libuv/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,15 @@ vcpkg_configure_cmake(
)

vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-libuv TARGET_PATH share/unofficial-libuv)
vcpkg_copy_pdbs()

configure_file(
${CMAKE_CURRENT_LIST_DIR}/unofficial-libuv-config.in.cmake
${CURRENT_PACKAGES_DIR}/share/unofficial-libuv/unofficial-libuv-config.cmake
@ONLY
)

file(READ ${CURRENT_PACKAGES_DIR}/include/uv.h UV_H)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
string(REPLACE "defined(USING_UV_SHARED)" "1" UV_H "${UV_H}")
Expand Down
7 changes: 7 additions & 0 deletions ports/libuv/unofficial-libuv-config.in.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static" AND NOT WIN32)
include(CMakeFindDependencyMacro)
find_dependency(Threads)
endif()

include(${CMAKE_CURRENT_LIST_DIR}/unofficial-libuv-targets.cmake)

0 comments on commit ac1bed3

Please sign in to comment.