Commit 62986ff6 by Scott J. Goldman

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.
parent ab4aa138
...@@ -7,7 +7,7 @@ language: erlang ...@@ -7,7 +7,7 @@ language: erlang
# Settings to try # Settings to try
env: env:
- OPTIONS="-DTHREADSAFE=ON -DCMAKE_BUILD_TYPE=Release" - OPTIONS="-DTHREADSAFE=ON -DCMAKE_BUILD_TYPE=Release"
- OPTIONS="-DBUILD_CLAR=ON" - OPTIONS="-DBUILD_CLAR=ON -DBUILD_EXAMPLES=ON"
# Make sure CMake is installed # Make sure CMake is installed
install: install:
......
...@@ -52,6 +52,7 @@ SET(INSTALL_INC include CACHE PATH "Where to install headers to.") ...@@ -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 (BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON)
OPTION (THREADSAFE "Build libgit2 as threadsafe" OFF) OPTION (THREADSAFE "Build libgit2 as threadsafe" OFF)
OPTION (BUILD_CLAR "Build Tests using the Clar suite" ON) 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 (TAGS "Generate tags" OFF)
OPTION (PROFILE "Generate profiling information" OFF) OPTION (PROFILE "Generate profiling information" OFF)
...@@ -183,3 +184,18 @@ IF (TAGS) ...@@ -183,3 +184,18 @@ IF (TAGS)
DEPENDS tags DEPENDS tags
) )
ENDIF () 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 ()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment