aboutsummaryrefslogtreecommitdiff
path: root/third-party/cmake/libtermkeyCMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'third-party/cmake/libtermkeyCMakeLists.txt')
-rw-r--r--third-party/cmake/libtermkeyCMakeLists.txt34
1 files changed, 34 insertions, 0 deletions
diff --git a/third-party/cmake/libtermkeyCMakeLists.txt b/third-party/cmake/libtermkeyCMakeLists.txt
new file mode 100644
index 0000000000..cb57631c1c
--- /dev/null
+++ b/third-party/cmake/libtermkeyCMakeLists.txt
@@ -0,0 +1,34 @@
+cmake_minimum_required(VERSION 2.8.7)
+project(libtermkey)
+
+add_definitions(-D _CRT_SECURE_NO_WARNINGS)
+add_definitions(-DHAVE_UNIBILIUM)
+if(NOT MSVC)
+ add_definitions(-std=c99)
+endif()
+
+include_directories(${PROJECT_BINARY_DIR}/t)
+include_directories(SYSTEM ${UNIBILIUM_INCLUDE_DIRS})
+
+add_library(termkey termkey.c driver-csi.c driver-ti.c)
+set_target_properties(termkey PROPERTIES
+ PUBLIC_HEADER ${PROJECT_SOURCE_DIR}/termkey.h)
+target_link_libraries(termkey ${UNIBILIUM_LIBRARIES})
+
+include(GNUInstallDirs)
+install(TARGETS termkey
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+
+enable_testing()
+file(GLOB TESTSOURCES "t/[0-9]*.c")
+foreach(f ${TESTSOURCES})
+ get_filename_component(t ${f} NAME_WE)
+ if(${t} STREQUAL 05read)
+ continue()
+ endif()
+
+ add_executable("test_${t}" ${f} t/taplib.c)
+ target_link_libraries("test_${t}" termkey)
+ add_test("${t}" "test_${t}")
+endforeach()