versatica / mediasoup-broadcaster-demo

mediasoup broadcaster demo (libmediasoupclient)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cmake: add_executable called with incorrect number of arguments

ibc opened this issue · comments

Building it as follows:

$ cmake . -Bbuild \
   -DLIBWEBRTC_INCLUDE_PATH:PATH=/Users/ibc/src/3rdparty/webrtc-checkout/src \
   -DLIBWEBRTC_BINARY_PATH:PATH=/Users/ibc/src/3rdparty/webrtc-checkout/src/out/M73/obj/libwebrtc.a \
   -DOPENSSL_INCLUDE_DIR:PATH=/usr/local/opt/openssl/include \
   -DCMAKE_USE_OPENSSL=ON

It fails with:

CMake Error at CMakeLists.txt:18 (add_executable):
  add_executable called with incorrect number of arguments

CMake Error at CMakeLists.txt:31 (target_link_libraries):
  Cannot specify link libraries for target "broadcaster" which is not built
  by this project.

The line in the CMakeLists.txt is as follows:

add_executable(${PROJECT_NAME} ${SOURCES})

Honestly I have no idea about what ${SOURCES} it.

I've cmake 3.9.4 which satisfies the required version.

According to the doc adding the source files to add_executable() if target_sources() is later called (which is).

Anyway, even this fails:

add_executable(${PROJECT_NAME})

=>

CMake Error at CMakeLists.txt:18 (add_executable):
  add_executable called with incorrect number of arguments

It does not produce the above error if we comment out the if(APPLE) block, so probably it builds in Linux (but fails in OSX).

Confirmed that it fails with cmake 3.9.4 and works with cmake 3.14.4.

@jmillan the CMakeLists.txt files has cmake_minimum_required(VERSION 3.8). We should not require a super higher version of cmake (i.e. "3.14") since Debian, for example, comes with 3.8.

Have you read the comments above? Which is the purpose of your comment if you don't even mention your cmake version?

Had the same issue. Ubuntu 18.04 cmake version 3.10.2
The easiest solution IMHO was to add one line
set( SOURCES src/Broadcaster.cpp src/main.cpp src/MediaStreamTrackFactory.cpp)

before add_executable(${PROJECT_NAME} ${SOURCES})

Using macOS:

cmake . -Bbuild \
  -DLIBWEBRTC_INCLUDE_PATH:PATH=~/webrtc/src \
  -DLIBWEBRTC_BINARY_PATH:PATH=~/webrtc/src/out/m84/obj   \
  -DOPENSSL_INCLUDE_DIR:PATH=/usr/local/Cellar/openssl@1.1/1.1.1h/include  \
  -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl@1.1/1.1.1h \
  -DOPENSSL_CRYPTO_LIBRARY=/usr/local/Cellar/openssl@1.1/1.1.1h/lib/libcrypto.1.1.dylib \
  -DCMAKE_USE_OPENSSL=ON

then
make -C build/
(i got this error !)

[ 80%] Built target cpr
[ 80%] Building CXX object libwebrtc/CMakeFiles/webrtc_broadcaster.dir/api/test/create_frame_generator.cc.o
In file included from /Users/said/mediasoup-broadcaster-demo/deps/libwebrtc/api/test/create_frame_generator.cc:17:
/Users/said/mediasoup-broadcaster-demo/deps/libwebrtc/test/frame_generator.h:23:10: fatal error: 'rtc_base/critical_section.h' file not found
#include "rtc_base/critical_section.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [libwebrtc/CMakeFiles/webrtc_broadcaster.dir/api/test/create_frame_generator.cc.o] Error 1
make[1]: *** [libwebrtc/CMakeFiles/webrtc_broadcaster.dir/all] Error 2
make: *** [all] Error 2

Hi,

I got the same error as said. My cmake version is 3.19.5 / MAC OS BigSur 11.2.1 / actual master branch and the local build of libwebrtc from today.

[ 80%] Built target cpr [ 80%] Building CXX object libwebrtc/CMakeFiles/webrtc_broadcaster.dir/api/test/create_frame_generator.cc.o In file included from /Users/said/mediasoup-broadcaster-demo/deps/libwebrtc/api/test/create_frame_generator.cc:17: /Users/said/mediasoup-broadcaster-demo/deps/libwebrtc/test/frame_generator.h:23:10: fatal error: 'rtc_base/critical_section.h' file not found #include "rtc_base/critical_section.h" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. make[2]: *** [libwebrtc/CMakeFiles/webrtc_broadcaster.dir/api/test/create_frame_generator.cc.o] Error 1 make[1]: *** [libwebrtc/CMakeFiles/webrtc_broadcaster.dir/all] Error 2 make: *** [all] Error 2

What libwebrtc version is supported by this demo app?

Thanks for your help!

Chris

Should already be fixed in the related PRs.