From 6a6e9d22b338bb2c290b7c7fd0ae434ad13232d9 Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Tue, 26 Jun 2018 23:22:25 +0900 Subject: lib: Compile custom glob() implementation for Android The Android C library doesn't provide the glob() function which we use in the configfs code. Add conditional compilation to cmake such that a local copy of glob is automatically compiled if glob isn't provided. Signed-off-by: Paul Elder Signed-off-by: Laurent Pinchart --- lib/CMakeLists.txt | 2 ++ lib/compat/CMakeLists.txt | 12 ++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 lib/compat/CMakeLists.txt (limited to 'lib') diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index ca08fd7..eacfb9c 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,6 +1,8 @@ file(GLOB SOURCES "*.c" "*.h") file(GLOB HEADERS "../include/uvcgadget/*.h") +add_subdirectory(compat) + add_library(uvcgadget ${SOURCES}) set_target_properties(uvcgadget PROPERTIES PUBLIC_HEADER "${HEADERS}") diff --git a/lib/compat/CMakeLists.txt b/lib/compat/CMakeLists.txt new file mode 100644 index 0000000..5fd6db4 --- /dev/null +++ b/lib/compat/CMakeLists.txt @@ -0,0 +1,12 @@ +include(CheckFunctionExists) +include(CheckIncludeFile) + +check_include_file(dirent.h HAVE_DIRENT_H) + +check_function_exists(glob HAVE_GLOB) +if(NOT HAVE_GLOB) + set(SOURCES "${SOURCES}" + "${CMAKE_CURRENT_SOURCE_DIR}/glob.c" + "${CMAKE_SOURCE_DIR}/include/compat/glob.h" + PARENT_SCOPE) +endif() -- cgit v1.2.3