File options.patch of Package akoc
Subject: [PATCH] options
---
Index: CMakeLists.txt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt (revision 643fb91e20f97209190bdf1f185d051343f650ea)
+++ b/CMakeLists.txt (date 1758931229366)
@@ -11,6 +11,9 @@
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
+option(AKOC_BUILD_TESTS "Build tests" ON)
+option(AKOC_BUILD_UTILS "Build utility programs" ON)
+
add_library(akoc
src/lex/tokenizer.c
src/mem/dyn_array.c
@@ -23,20 +26,24 @@
$<INSTALL_INTERFACE:include>
)
-#Test
-project(akotest C)
-add_executable(akotest test/main.c)
-target_include_directories(akotest PUBLIC akoc)
-target_link_libraries(akotest PUBLIC akoc)
+if(AKOC_BUILD_TESTS)
+ #Test
+ project(akotest C)
+ add_executable(akotest test/main.c)
+ target_include_directories(akotest PUBLIC akoc)
+ target_link_libraries(akotest PUBLIC akoc)
-enable_testing()
+ enable_testing()
-add_test(NAME akotest
- COMMAND $<TARGET_FILE:akotest>
-)
+ add_test(NAME akotest
+ COMMAND $<TARGET_FILE:akotest>
+ )
+endif()
-# A bunch of small cli tools
-add_subdirectory(utils)
+if(AKOC_BUILD_UTILS)
+ # A bunch of small cli tools
+ add_subdirectory(utils)
+endif()
include(GNUInstallDirs)