From 66902d47737da1100de5e24498cf8c7260b183df Mon Sep 17 00:00:00 2001 From: Russell Belfer Date: Tue, 29 Oct 2013 18:30:49 -0700 Subject: Extract common example helpers and reorg examples This reorganizes a few of the examples so that the main function comes first with the argument parsing extracted into a helper that can come at the end of the file (so the example focuses more on the use of libgit2 instead of command line support). This also creates a shared examples/common.[ch] so that useful helper funcs can be shared across examples instead of repeated. --- examples/CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'examples/CMakeLists.txt') diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index c20a6df3b..596be45ed 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -9,6 +9,8 @@ ENDIF() FILE(GLOB SRC_EXAMPLE_APPS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.c) FOREACH(src_app ${SRC_EXAMPLE_APPS}) STRING(REPLACE ".c" "" app_name ${src_app}) - ADD_EXECUTABLE(${app_name} ${src_app}) - TARGET_LINK_LIBRARIES(${app_name} git2) + IF(NOT ${app_name} STREQUAL "common") + ADD_EXECUTABLE(${app_name} ${src_app} "common.c") + TARGET_LINK_LIBRARIES(${app_name} git2) + ENDIF() ENDFOREACH() -- cgit v1.2.1