diff --git a/CMakeLists.txt b/CMakeLists.txt index f4b9e6c8..6f9f957e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,9 @@ SET(PROJECT_VERSION "${SEAFILE_CLIENT_VERSION_MAJOR}.${SEAFILE_CLIENT_VERSION_MI ADD_DEFINITIONS(-DSEAFILE_CLIENT_VERSION=${PROJECT_VERSION}) ADD_DEFINITIONS(-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26) INCLUDE(FindPkgConfig) +INCLUDE(CheckLibraryExists) +INCLUDE(CheckFunctionExists) +INCLUDE(CheckIncludeFiles) ## Build crash repoter on release build as default IF (NOT (${CMAKE_BUILD_TYPE} MATCHES Release)) @@ -362,6 +365,30 @@ ENDIF() ###### END: QT configuration #################### +#################### +##### BEGIN FTS fix +#################### + +CHECK_INCLUDE_FILES("sys/types.h;sys/stat.h;fts.h" HAVE_FTS_H) +# fts functions may be in external library +IF(HAVE_FTS_H) + CHECK_FUNCTION_EXISTS(fts_open HAVE_FTS_OPEN) + IF(NOT HAVE_FTS_OPEN) + CHECK_LIBRARY_EXISTS(fts fts_open "" HAVE_LIB_FTS) + ENDIF(NOT HAVE_FTS_OPEN) +ENDIF(HAVE_FTS_H) + +IF(HAVE_LIB_FTS) + SET(FTS_LIB fts) +ELSE() + SET(FTS_LIB "") +ENDIF() + +#################### +###### END FTS fix +#################### + + #################### ###### BEGIN: pthread support is required explicitly on linux #################### @@ -585,7 +612,8 @@ FUNCTION(ADD_SC_LIBRARY name) TARGET_LINK_LIBRARIES(${name} ${QT_LIBRARIES} ${SQLITE3_LIBRARIES} ${JANSSON_LIBRARIES} - ${EXTRA_LIBS} -lglib-2.0 ${ARG_LINK_LIBS} ${ZLIB_LIBRARIES}) + ${EXTRA_LIBS} -lglib-2.0 ${ARG_LINK_LIBS} ${ZLIB_LIBRARIES} ${FTS_LIB}) + ENDFUNCTION(ADD_SC_LIBRARY) # library utils