I'm trying to download a dependency from GitHub, build it, and link to it.
# External dependency
ExternalProject_Add(libdatachannel
GIT_REPOSITORY git@github.com:paullouisageneau/libdatachannel.git
GIT_TAG v0.18.0
GIT_PROGRESS TRUE
GIT_SHALLOW TRUE
)
# My library - actual main target
add_library(
test
SHARED
src/main/cpp/test.cpp # and so on
)
add_dependencies(test libdatachannel)
Now libdatachannel uses CMake. But it does not build a static variant by default, using EXCLUDE_FROM_ALL
:
https://github.com/paullouisageneau/libdatachannel/blob/v0.18.0/CMakeLists.txt#L237
Question 1 - how can I build this custom target inside libdatachannel - datachannel-static
?
Question 2 - how can I set include paths for accessing datachannel includes from my test
library - as well as link to the static version of datachannel
?
Question 3 - Libdatachannel's readme file here
https://github.com/paullouisageneau/libdatachannel/blob/v0.18.0/BUILDING.md
mentions that "The CMake build exports the targets with namespace LibDataChannel::LibDataChannel and LibDataChannel::LibDataChannelStatic to link the library from another CMake project".
I'm not sure how to use these custom targets exported by libdatachannel in my project.
I tried this, but got errors from cmake:
target_link_libraries(plugin PRIVATE LibDataChannel::LibDataChannelStatic)
I'm running the top level CMake project as part of an Android build which uses Gradle and specific stanzas to invoke CMake.