From 82b2fc2c8325830667ed780ae5402674c7b9bbf5 Mon Sep 17 00:00:00 2001 From: Krzysztof Adamski Date: Sun, 1 Sep 2013 18:45:36 +0200 Subject: [PATCH] Create ANDROID build option CMake seems not to support Android as a target and this option lets us test this in CMakeLists.txt. --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c70ec2d6..a9b87b8a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,8 @@ OPTION( PROFILE "Generate profiling information" OFF ) OPTION( ENABLE_TRACE "Enables tracing support" OFF ) OPTION( LIBGIT2_FILENAME "Name of the produced binary" OFF ) +OPTION( ANDROID "Build for android NDK" OFF ) + IF(MSVC) # This option is only available when building with MSVC. By default, libgit2 # is build using the cdecl calling convention, which is useful if you're @@ -127,7 +129,7 @@ IF (ENABLE_TRACE STREQUAL "ON") ENDIF() # Include POSIX regex when it is required -IF(WIN32 OR AMIGA) +IF(WIN32 OR AMIGA OR ANDROID) INCLUDE_DIRECTORIES(deps/regex) SET(SRC_REGEX deps/regex/regex.c) ENDIF() @@ -409,7 +411,7 @@ ENDIF () IF (BUILD_EXAMPLES) FILE(GLOB_RECURSE EXAMPLE_SRC examples/network/*.c examples/network/*.h) ADD_EXECUTABLE(cgit2 ${EXAMPLE_SRC}) - IF(WIN32) + IF(WIN32 OR ANDROID) TARGET_LINK_LIBRARIES(cgit2 git2) ELSE() TARGET_LINK_LIBRARIES(cgit2 git2 pthread)