Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include cmake rules for third party libraries only if it needed #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
15 changes: 15 additions & 0 deletions cmake/external.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ function(link_libabsl target_name)
endif()
endif()
if (NOT absl_FOUND)
if (NOT TARGET libabsl)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why other cases don't do this check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only link_libabsl called twice. Will I add this check to other cases?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory any of them could be called any amount of times

include(cmake/libabsl.cmake)
endif()
target_link_libraries(${target_name} PRIVATE tg_owt::libabsl)
endif()
endfunction()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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}
Expand Down Expand Up @@ -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()
Expand Down