Skip to content

Commit 46bd2aa

Browse files
Cheney-WCheney-Wang
andauthored
vcpkg zlib dep fix (#385)
* vcpkg zlib dep fix * Use cmake.in file instead of write file directly Co-authored-by: Cheney-Wang <v-xincwa@microsoft.com>
1 parent 4420bc7 commit 46bd2aa

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,7 @@ endif()
234234
option(USE_ZLIB "Enable zlib support" TRUE)
235235

236236
if (USE_ZLIB)
237-
# This ZLIB_FOUND check is to help find a cmake manually configured zlib
238-
if (NOT ZLIB_FOUND)
239-
find_package(ZLIB REQUIRED)
240-
endif()
241-
target_include_directories(ixwebsocket PUBLIC $<BUILD_INTERFACE:${ZLIB_INCLUDE_DIRS}>)
237+
find_package(ZLIB REQUIRED)
242238
target_link_libraries(ixwebsocket PRIVATE ZLIB::ZLIB)
243239

244240
target_compile_definitions(ixwebsocket PUBLIC IXWEBSOCKET_USE_ZLIB)
@@ -289,10 +285,14 @@ if (IXWEBSOCKET_INSTALL)
289285
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ixwebsocket/
290286
)
291287

288+
configure_file("${CMAKE_CURRENT_LIST_DIR}/ixwebsocket-config.cmake.in" "${CMAKE_BINARY_DIR}/ixwebsocket-config.cmake" @ONLY)
289+
install(FILES "${CMAKE_BINARY_DIR}/ixwebsocket-config.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/ixwebsocket")
290+
292291
install(EXPORT ixwebsocket
293-
FILE ixwebsocket-config.cmake
292+
FILE ixwebsocket-targets.cmake
294293
NAMESPACE ixwebsocket::
295-
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ixwebsocket)
294+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ixwebsocket
295+
)
296296
endif()
297297

298298
if (USE_WS OR USE_TEST)

ixwebsocket-config.cmake.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@PACKAGE_INIT@
2+
3+
include(CMakeFindDependencyMacro)
4+
5+
if(@USE_ZLIB@)
6+
find_dependency(ZLIB)
7+
endif()
8+
9+
include("${CMAKE_CURRENT_LIST_DIR}/ixwebsocket-targets.cmake")

0 commit comments

Comments
 (0)