From b588aee2c8e1e0c6fa8cbaa00a700c86f1a01192 Mon Sep 17 00:00:00 2001 From: Vitaly Lipatov Date: Sun, 4 Jul 2021 18:41:32 +0300 Subject: [PATCH] include cmake rules for third party libraries only if it needed --- CMakeLists.txt | 7 ------- cmake/external.cmake | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f5696edba..a9e1f7aad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,17 +63,10 @@ include(cmake/init_target.cmake) include(cmake/generate_target.cmake) include(cmake/target_yasm_sources.cmake) include(cmake/external.cmake) -include(cmake/libabsl.cmake) -include(cmake/libopenh264.cmake) include(cmake/libpffft.cmake) include(cmake/librnnoise.cmake) include(cmake/libsrtp.cmake) -include(cmake/libusrsctp.cmake) -include(cmake/libvpx.cmake) include(cmake/libyuv.cmake) -if (NOT WIN32 AND NOT APPLE) - include(cmake/libevent.cmake) -endif() if (APPLE) include(cmake/libsdkmacos.cmake) endif() diff --git a/cmake/external.cmake b/cmake/external.cmake index 03e2d259c..82510f2ed 100644 --- a/cmake/external.cmake +++ b/cmake/external.cmake @@ -117,6 +117,9 @@ function(link_libabsl target_name) endif() endif() if (NOT absl_FOUND) + if (NOT TARGET libabsl) + include(cmake/libabsl.cmake) + endif() target_link_libraries(${target_name} PRIVATE tg_owt::libabsl) endif() endfunction() @@ -133,6 +136,9 @@ function(link_libopenh264 target_name) endif() endif() if (NOT LIBOPENH264_FOUND) + if (NOT TARGET libopenh264) + include(cmake/libopenh264.cmake) + endif() target_link_libraries(${target_name} PRIVATE tg_owt::libopenh264) target_include_directories(${target_name} PRIVATE ${libopenh264_loc}/include) endif() @@ -150,6 +156,9 @@ function(link_libusrsctp target_name) endif() endif() if (NOT LIBUSRSCTP_FOUND) + if (NOT TARGET libusrsctp) + include(cmake/libusrsctp.cmake) + endif() target_link_libraries(${target_name} PRIVATE tg_owt::libusrsctp) endif() endfunction() @@ -166,6 +175,9 @@ function(link_libvpx target_name) endif() endif() if (NOT LIBVPX_FOUND) + if (NOT TARGET libvpx) + include(cmake/libvpx.cmake) + endif() target_link_libraries(${target_name} PRIVATE tg_owt::libvpx) if (is_x86 OR is_x64) target_link_libraries(${target_name} @@ -193,6 +205,9 @@ function(link_libevent target_name) endif() endif() if (NOT LIBEVENT_FOUND) + if (NOT TARGET libevent) + include(cmake/libevent.cmake) + endif() target_link_libraries(${target_name} PRIVATE tg_owt::libevent) endif() endfunction()