summaryrefslogtreecommitdiff
path: root/examples/CMakeLists.txt
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-10-29 18:30:49 -0700
committerRussell Belfer <rb@github.com>2013-10-29 18:30:49 -0700
commit66902d47737da1100de5e24498cf8c7260b183df (patch)
tree117d7b44402f2ec6408a80df9ba5eee81212df7b /examples/CMakeLists.txt
parent5c50f22a93c78190fb7d81802199ff9defc8cf55 (diff)
downloadlibgit2-66902d47737da1100de5e24498cf8c7260b183df.tar.gz
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.
Diffstat (limited to 'examples/CMakeLists.txt')
-rw-r--r--examples/CMakeLists.txt6
1 files changed, 4 insertions, 2 deletions
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()