vcpkg/ports/libhv/fix-export_cmake.patch
LilyWangLL 3e7517b24f
[libhv] Export CMake config files (#25042)
* [libhv] Export CMake config files

* x-add-version

* update patch

* x-add-version

Co-authored-by: Lily Wang <v-lilywang@microsoft.com>
2022-06-06 09:45:02 -07:00

37 lines
1.5 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f478fb4..1e3556a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -196,9 +196,10 @@ list_source_directories(LIBHV_SRCS ${LIBHV_SRCDIRS})
if(BUILD_SHARED)
add_library(hv SHARED ${LIBHV_SRCS})
target_compile_definitions(hv PRIVATE HV_DYNAMICLIB)
- target_include_directories(hv PRIVATE ${LIBHV_SRCDIRS})
+ target_include_directories(hv PRIVATE ${LIBHV_SRCDIRS} INTERFACE $<INSTALL_INTERFACE:include>)
target_link_libraries(hv ${LIBS})
install(TARGETS hv
+ EXPORT libhvConfig
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
@@ -208,14 +209,17 @@ endif()
if(BUILD_STATIC)
add_library(hv_static STATIC ${LIBHV_SRCS})
target_compile_definitions(hv_static PRIVATE HV_STATICLIB)
- target_include_directories(hv_static PRIVATE ${LIBHV_SRCDIRS})
+ target_include_directories(hv_static PRIVATE ${LIBHV_SRCDIRS} INTERFACE $<INSTALL_INTERFACE:include>)
target_link_libraries(hv_static ${LIBS})
- install(TARGETS hv_static DESTINATION lib)
+ install(TARGETS hv_static
+ EXPORT libhvConfig
+ ARCHIVE DESTINATION lib)
add_custom_target(libhv_static DEPENDS hv_static)
endif()
file(INSTALL ${LIBHV_HEADERS} DESTINATION include/hv)
install(FILES ${LIBHV_HEADERS} DESTINATION include/hv)
+install(EXPORT libhvConfig DESTINATION lib/cmake/libhv)
if(BUILD_SHARED)
set(HV_LIBRARIES hv CACHE INTERNAL "link hv libraries")