diff options
author | Scott J. Goldman <scottjgo@gmail.com> | 2012-05-20 00:46:48 -0700 |
---|---|---|
committer | Scott J. Goldman <scottjgo@gmail.com> | 2012-05-20 00:52:49 -0700 |
commit | 62986ff6de9b113ac23617b4e1f652ec6f609b8c (patch) | |
tree | a6676280599a23065df68c08127176530ab5d707 | |
parent | ab4aa138ada1b088cdaa7e20d843011aa48c1659 (diff) | |
download | libgit2-62986ff6de9b113ac23617b4e1f652ec6f609b8c.tar.gz |
Add CMake build for examples / add them to Travis
By default, they are still not built, but hopefully, now that Travis is
building them, this will help stave off some of the bitrot.
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | CMakeLists.txt | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/.travis.yml b/.travis.yml index b9a08dc59..11c85bbc4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ language: erlang # Settings to try env: - OPTIONS="-DTHREADSAFE=ON -DCMAKE_BUILD_TYPE=Release" - - OPTIONS="-DBUILD_CLAR=ON" + - OPTIONS="-DBUILD_CLAR=ON -DBUILD_EXAMPLES=ON" # Make sure CMake is installed install: diff --git a/CMakeLists.txt b/CMakeLists.txt index bfbabc0a5..165baba78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,7 @@ SET(INSTALL_INC include CACHE PATH "Where to install headers to.") OPTION (BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON) OPTION (THREADSAFE "Build libgit2 as threadsafe" OFF) OPTION (BUILD_CLAR "Build Tests using the Clar suite" ON) +OPTION (BUILD_EXAMPLES "Build library usage example apps" OFF) OPTION (TAGS "Generate tags" OFF) OPTION (PROFILE "Generate profiling information" OFF) @@ -183,3 +184,18 @@ IF (TAGS) DEPENDS tags ) ENDIF () + +IF (BUILD_EXAMPLES) + FILE(GLOB_RECURSE EXAMPLE_SRC examples/network/*.c) + ADD_EXECUTABLE(cgit2 ${EXAMPLE_SRC}) + TARGET_LINK_LIBRARIES(cgit2 git2 pthread) + + ADD_EXECUTABLE(git-diff examples/diff.c) + TARGET_LINK_LIBRARIES(git-diff git2) + + ADD_EXECUTABLE(git-general examples/general.c) + TARGET_LINK_LIBRARIES(git-general git2) + + ADD_EXECUTABLE(git-showindex examples/showindex.c) + TARGET_LINK_LIBRARIES(git-showindex git2) +ENDIF () |