2019-04-29 07:24:39 +08:00
|
|
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
|
|
|
|
2019-09-21 14:24:04 +08:00
|
|
|
project(kcp LANGUAGES C)
|
2019-04-29 07:24:39 +08:00
|
|
|
|
2019-09-21 14:24:04 +08:00
|
|
|
include(CTest)
|
|
|
|
include(GNUInstallDirs)
|
2019-04-29 07:24:39 +08:00
|
|
|
|
2019-09-21 14:24:04 +08:00
|
|
|
add_library(kcp STATIC ikcp.c)
|
2019-04-29 07:24:39 +08:00
|
|
|
|
2019-09-21 14:24:04 +08:00
|
|
|
install(FILES ikcp.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
2019-04-29 07:24:39 +08:00
|
|
|
|
2019-09-21 14:24:04 +08:00
|
|
|
install(TARGETS kcp
|
|
|
|
EXPORT kcp-targets
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
|
|
)
|
2019-04-29 07:24:39 +08:00
|
|
|
|
2019-09-21 14:24:04 +08:00
|
|
|
install(EXPORT kcp-targets
|
|
|
|
FILE kcp-config.cmake
|
|
|
|
NAMESPACE kcp::
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/kcp
|
|
|
|
)
|
2019-04-29 07:24:39 +08:00
|
|
|
|
2019-09-21 14:24:04 +08:00
|
|
|
if (BUILD_TESTING)
|
|
|
|
enable_language(CXX)
|
|
|
|
|
|
|
|
add_executable(kcp_test test.cpp)
|
|
|
|
if(MSVC AND NOT (MSVC_VERSION LESS 1900))
|
|
|
|
target_compile_options(kcp_test PRIVATE /utf-8)
|
|
|
|
endif()
|
|
|
|
endif ()
|