diff options
Diffstat (limited to 'protocols/Telegram/tdlib/td/tdutils/CMakeLists.txt')
| -rw-r--r-- | protocols/Telegram/tdlib/td/tdutils/CMakeLists.txt | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/protocols/Telegram/tdlib/td/tdutils/CMakeLists.txt b/protocols/Telegram/tdlib/td/tdutils/CMakeLists.txt index e7b4b788a7..4760aab011 100644 --- a/protocols/Telegram/tdlib/td/tdutils/CMakeLists.txt +++ b/protocols/Telegram/tdlib/td/tdutils/CMakeLists.txt @@ -3,12 +3,13 @@ if ((CMAKE_MAJOR_VERSION LESS 3) OR (CMAKE_VERSION VERSION_LESS "3.0.2")) endif() option(TDUTILS_MIME_TYPE "Generate MIME types conversion; requires gperf" ON) +option(TDUTILS_USE_EXTERNAL_DEPENDENCIES "Use external libraries if available" ON) if (NOT DEFINED CMAKE_INSTALL_LIBDIR) set(CMAKE_INSTALL_LIBDIR "lib") endif() -if (NOT ZLIB_FOUND) +if (NOT ZLIB_FOUND AND TDUTILS_USE_EXTERNAL_DEPENDENCIES) find_package(ZLIB) endif() if (ZLIB_FOUND) @@ -24,11 +25,14 @@ if (ZLIB_FOUND) endif() endif() +if (NOT CRC32C_FOUND AND TDUTILS_USE_EXTERNAL_DEPENDENCIES) + find_package(Crc32c QUIET) +endif() if (CRC32C_FOUND) set(TD_HAVE_CRC32C 1) endif() -if (TD_WITH_ABSEIL) +if (TD_WITH_ABSEIL AND TDUTILS_USE_EXTERNAL_DEPENDENCIES) find_package(ABSL QUIET) if (ABSL_FOUND) set(TD_HAVE_ABSL 1) @@ -39,7 +43,6 @@ configure_file(td/utils/config.h.in td/utils/config.h @ONLY) add_subdirectory(generate) -# TDUTILS set_source_files_properties(${TDMIME_AUTO} PROPERTIES GENERATED TRUE) if (CLANG OR GCC) set_property(SOURCE ${TDMIME_AUTO} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-conversion") @@ -104,6 +107,7 @@ set(TDUTILS_SOURCE td/utils/Gzip.cpp td/utils/GzipByteFlow.cpp td/utils/Hints.cpp + td/utils/HttpDate.cpp td/utils/HttpUrl.cpp td/utils/JsonBuilder.cpp td/utils/logging.cpp @@ -120,7 +124,6 @@ set(TDUTILS_SOURCE td/utils/tests.cpp td/utils/Time.cpp td/utils/Timer.cpp - td/utils/TsFileLog.cpp td/utils/tl_parsers.cpp td/utils/translit.cpp td/utils/TsCerr.cpp @@ -136,8 +139,8 @@ set(TDUTILS_SOURCE td/utils/port/EventFdBase.h td/utils/port/FileFd.h td/utils/port/FromApp.h - td/utils/port/IPAddress.h td/utils/port/IoSlice.h + td/utils/port/IPAddress.h td/utils/port/MemoryMapping.h td/utils/port/Mutex.h td/utils/port/path.h @@ -210,8 +213,8 @@ set(TDUTILS_SOURCE td/utils/ExitGuard.h td/utils/FileLog.h td/utils/filesystem.h - td/utils/fixed_vector.h td/utils/find_boundary.h + td/utils/fixed_vector.h td/utils/FlatHashMap.h td/utils/FlatHashMapChunks.h td/utils/FlatHashSet.h @@ -229,6 +232,7 @@ set(TDUTILS_SOURCE td/utils/HazardPointers.h td/utils/Heap.h td/utils/Hints.h + td/utils/HttpDate.h td/utils/HttpUrl.h td/utils/int_types.h td/utils/invoke.h @@ -241,8 +245,8 @@ set(TDUTILS_SOURCE td/utils/MovableValue.h td/utils/MpmcQueue.h td/utils/MpmcWaiter.h - td/utils/MpscPollableQueue.h td/utils/MpscLinkQueue.h + td/utils/MpscPollableQueue.h td/utils/Named.h td/utils/NullLog.h td/utils/ObjectPool.h @@ -345,7 +349,6 @@ set(TDUTILS_TEST_SOURCE PARENT_SCOPE ) -#LIBRARIES add_library(tdutils STATIC ${TDUTILS_SOURCE}) if (NOT CMAKE_CROSSCOMPILING AND TDUTILS_MIME_TYPE) @@ -401,17 +404,17 @@ if (ANDROID) target_link_libraries(tdutils PRIVATE log) endif() -if (CMAKE_SYSTEM_NAME MATCHES "NetBSD") - target_link_directories(tdutils PUBLIC /usr/pkg/gcc12/x86_64--netbsd/lib /usr/pkg/gcc12/i486--netbsdelf/lib) - target_link_libraries(tdutils PUBLIC atomic) +find_package(Atomics REQUIRED) +if (ATOMICS_LIBRARIES) + target_link_libraries(tdutils PUBLIC "${ATOMICS_LIBRARIES}") endif() -install(TARGETS tdutils EXPORT TdTargets +install(TARGETS tdutils EXPORT TdStaticTargets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ) -if (TD_TEST_FOLLY AND ABSL_FOUND) +if (TD_TEST_FOLLY AND ABSL_FOUND AND TDUTILS_USE_EXTERNAL_DEPENDENCIES) find_package(benchmark QUIET) find_package(folly QUIET) find_package(gflags QUIET) |
