use GNUInstallDirs in cmake (#318)

Signed-off-by: NexAdn <git@nexadn.de>

Co-authored-by: NexAdn <git@nexadn.de>
This commit is contained in:
Adrian Schollmeyer 2021-09-21 03:11:46 +02:00 committed by GitHub
parent dbafa0aa07
commit cdeaf8e2be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -242,23 +242,25 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
target_compile_options(ixwebsocket PRIVATE /MP) target_compile_options(ixwebsocket PRIVATE /MP)
endif() endif()
include(GNUInstallDirs)
target_include_directories(ixwebsocket PUBLIC target_include_directories(ixwebsocket PUBLIC
$<BUILD_INTERFACE:${IXWEBSOCKET_INCLUDE_DIRS}/> $<BUILD_INTERFACE:${IXWEBSOCKET_INCLUDE_DIRS}/>
$<INSTALL_INTERFACE:include/ixwebsocket> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/ixwebsocket>
) )
set_target_properties(ixwebsocket PROPERTIES PUBLIC_HEADER "${IXWEBSOCKET_HEADERS}") set_target_properties(ixwebsocket PROPERTIES PUBLIC_HEADER "${IXWEBSOCKET_HEADERS}")
install(TARGETS ixwebsocket install(TARGETS ixwebsocket
EXPORT ixwebsocket EXPORT ixwebsocket
ARCHIVE DESTINATION lib ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION include/ixwebsocket/ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ixwebsocket/
) )
install(EXPORT ixwebsocket install(EXPORT ixwebsocket
FILE ixwebsocket-config.cmake FILE ixwebsocket-config.cmake
NAMESPACE ixwebsocket:: NAMESPACE ixwebsocket::
DESTINATION lib/cmake/ixwebsocket) DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/ixwebsocket)
if (USE_WS OR USE_TEST) if (USE_WS OR USE_TEST)
include(FetchContent) include(FetchContent)