aboutsummaryrefslogtreecommitdiff
path: root/tools/wdye/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'tools/wdye/CMakeLists.txt')
-rw-r--r--tools/wdye/CMakeLists.txt26
1 files changed, 22 insertions, 4 deletions
diff --git a/tools/wdye/CMakeLists.txt b/tools/wdye/CMakeLists.txt
index 73872ee..a69f7ee 100644
--- a/tools/wdye/CMakeLists.txt
+++ b/tools/wdye/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.10)
+cmake_minimum_required (VERSION 3.18)
project (wdye VERSION 1 DESCRIPTION "What did you expect?" LANGUAGES C)
set (CMAKE_C_STANDARD 99)
@@ -12,13 +12,31 @@ add_compile_options ("$<$<CXX_COMPILER_ID:Clang>:${options}>")
set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../../cmake")
-find_package (Curses REQUIRED)
+find_package (Curses)
find_package (PkgConfig REQUIRED)
-# TODO: Once written, check the lowest and highest usable version.
pkg_search_module (lua REQUIRED
lua53 lua5.3 lua-5.3 lua54 lua5.4 lua-5.4 lua>=5.3)
+option (WITH_CURSES "Offer terminal sequences using Curses" "${CURSES_FOUND}")
+
+# -liconv may or may not be a part of libc
+find_path (iconv_INCLUDE_DIRS iconv.h)
+
+include_directories ("${PROJECT_BINARY_DIR}" ${iconv_INCLUDE_DIRS})
+file (CONFIGURE OUTPUT "${PROJECT_BINARY_DIR}/config.h" CONTENT [[
+#define PROGRAM_NAME "${PROJECT_NAME}"
+#define PROGRAM_VERSION "${PROJECT_VERSION}"
+#cmakedefine WITH_CURSES
+]])
+
add_executable (wdye wdye.c)
target_include_directories (wdye PUBLIC ${lua_INCLUDE_DIRS})
target_link_directories (wdye PUBLIC ${lua_LIBRARY_DIRS})
-target_link_libraries (wdye PUBLIC ${CURSES_LIBRARIES} ${lua_LIBRARIES})
+target_link_libraries (wdye PUBLIC ${lua_LIBRARIES})
+if (WITH_CURSES)
+ target_include_directories (wdye PUBLIC ${CURSES_INCLUDE_DIRS})
+ target_link_libraries (wdye PUBLIC ${CURSES_LIBRARIES})
+endif ()
+
+add_test (NAME simple COMMAND wdye "${PROJECT_SOURCE_DIR}/test.lua")
+include (CTest)