-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add install target - add BUILD_TESTING option
- Loading branch information
Showing
1 changed file
with
23 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,31 @@ | ||
PROJECT(kcp) | ||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6) | ||
|
||
add_library(kcp STATIC ikcp.c) | ||
project(kcp LANGUAGES C) | ||
|
||
add_executable(kcp_test test.cpp) | ||
include(CTest) | ||
include(GNUInstallDirs) | ||
|
||
add_library(kcp STATIC ikcp.c) | ||
|
||
install(FILES ikcp.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
|
||
install(TARGETS kcp | ||
EXPORT kcp-targets | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
) | ||
|
||
install(EXPORT kcp-targets | ||
FILE kcp-config.cmake | ||
NAMESPACE kcp:: | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/kcp | ||
) | ||
|
||
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 () |