diff options
author | Paul Elder <paul.elder@ideasonboard.com> | 2018-06-26 23:22:25 +0900 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2018-07-31 15:56:48 +0300 |
commit | 6a6e9d22b338bb2c290b7c7fd0ae434ad13232d9 (patch) | |
tree | 9f9a2a1d0f12881acc0f46e93a246eb90f39daba /lib | |
parent | 35a4212180272b5dd648b99c07a692aab19a5e67 (diff) |
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 <paul.elder@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CMakeLists.txt | 2 | ||||
-rw-r--r-- | lib/compat/CMakeLists.txt | 12 |
2 files changed, 14 insertions, 0 deletions
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() |