From 2fbb1a846f077fe3d71891f697c1a45585a0d949 Mon Sep 17 00:00:00 2001 From: Xu Zhipei Date: Sun, 14 Jun 2020 12:04:43 +0800 Subject: [PATCH] feat(cmake): add cmake find config support (#213) --- CMakeLists.txt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index acb58929..0d715270 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -238,15 +238,24 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") target_compile_options(ixwebsocket PRIVATE /MP) endif() -target_include_directories(ixwebsocket PUBLIC ${IXWEBSOCKET_INCLUDE_DIRS}) +target_include_directories(ixwebsocket PUBLIC + $ + $ +) set_target_properties(ixwebsocket PROPERTIES PUBLIC_HEADER "${IXWEBSOCKET_HEADERS}") install(TARGETS ixwebsocket - ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ixwebsocket/ + EXPORT ixwebsocket + ARCHIVE DESTINATION lib + PUBLIC_HEADER DESTINATION include/ixwebsocket/ ) +install(EXPORT ixwebsocket + FILE ixwebsocket-config.cmake + NAMESPACE ixwebsocket:: + DESTINATION lib/cmake/ixwebsocket) + if (USE_WS OR USE_TEST) add_subdirectory(ixcore) add_subdirectory(ixcrypto)