From 5d32600050088ef1654945a56280949de78130ae Mon Sep 17 00:00:00 2001 From: Edward Hesketh Date: Sat, 7 Dec 2024 13:29:41 +0000 Subject: [PATCH] docs: add cmake example --- CMakeLists.txt | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6495048..f34a8f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,31 +2,33 @@ cmake_minimum_required(VERSION 3.12) project(squirrel) -# Override this in your build of the library! Otherwise, it will default to 1 key. +# target_compile_definitions(squirrel PUBLIC SQUIRREL_KEYCOUNT=your_keycount) +# Override this using the above line in your build of the library! Otherwise, it +# will default to 1 key. add_compile_definitions(SQUIRREL_KEYCOUNT=1) -if (CMAKE_BUILD_TYPE STREQUAL "Debug") - set(CMAKE_EXPORT_COMPILE_COMMANDS ON) - add_compile_options(-Og) +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + add_compile_options(-Og) else() - add_compile_options(-Os) + add_compile_options(-Os) endif() # Generate a static library archive. -add_library(squirrel STATIC - src/squirrel.c - src/squirrel_quantum.c - src/squirrel_keyboard.c - src/squirrel_key.c - src/squirrel_consumer.c - src/squirrel_init.c - src/squirrel_keymap.c - src/squirrel_split.c - ) +add_library( + squirrel STATIC + src/squirrel.c + src/squirrel_quantum.c + src/squirrel_keyboard.c + src/squirrel_key.c + src/squirrel_consumer.c + src/squirrel_init.c + src/squirrel_keymap.c + src/squirrel_split.c) target_include_directories(squirrel PUBLIC include) set_target_properties(squirrel PROPERTIES PUBLIC_HEADER include/squirrel.h) -if (BUILD_TESTING) - add_subdirectory(tests) +if(BUILD_TESTING) + add_subdirectory(tests) endif()