0

I'm writing simple app using pjsip library. From this question I found CMakeLists.txt file example. However I've got a lot of unresolved symbol errors when trying to compile my app. For pjsip building I use following command ./configure && make dep && make && make install. Here is my CMakeLists.txt:

cmake_minimum_required(VERSION 3.14.0)
project(ssc)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(THREADS_PREFER_PTHREAD_FLAG ON)


INCLUDE(FindPkgConfig)
find_package(PkgConfig REQUIRED)
find_package(Threads REQUIRED)
find_package(OpenSSL REQUIRED)

pkg_check_modules(PJSIP "libpjproject")

add_definitions(${PJSIP_CFLAGS})

include_directories(${PJSIP_INCLUDE_DIRS})
link_directories(${PJSIP_LIBRARY_DIRS})

add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE ${PJSIP_LIBRARIES})
target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads)
target_link_libraries(${PROJECT_NAME} PRIVATE OpenSSL::Crypto)
target_link_libraries(${PROJECT_NAME} PRIVATE OpenSSL::SSL)

My c++ code is just copy-paste from pjsip example:

#include <pjsua2.hpp>
#include <iostream>

using namespace pj;

// Subclass to extend the Account and get notifications etc.
class MyAccount : public Account {
public:
    virtual void onRegState(OnRegStateParam &prm) {
        AccountInfo ai = getInfo();
        std::cout << (ai.regIsActive? "*** Register:" : "*** Unregister:")
                  << " code=" << prm.code << std::endl;
    }
};

int main()
{
    Endpoint ep;

    ep.libCreate();

    // Initialize endpoint
    EpConfig ep_cfg;
    ep.libInit( ep_cfg );

    // Create SIP transport. Error handling sample is shown
    TransportConfig tcfg;
    tcfg.port = 5060;
    try {
        ep.transportCreate(PJSIP_TRANSPORT_UDP, tcfg);
    } catch (Error &err) {
        std::cout << err.info() << std::endl;
        return 1;
    }

    // Start the library (worker threads etc)
    ep.libStart();
    std::cout << "*** PJSUA2 STARTED ***" << std::endl;

    // Configure an AccountConfig
    AccountConfig acfg;
    acfg.idUri = "sip:test@sip.pjsip.org";
    acfg.regConfig.registrarUri = "sip:sip.pjsip.org";
    AuthCredInfo cred("digest", "*", "test", 0, "secret");
    acfg.sipConfig.authCreds.push_back( cred );

    // Create the account
    MyAccount *acc = new MyAccount;
    acc->create(acfg);

    // Here we don't have anything else to do..
    pj_thread_sleep(10000);

    // Delete the account. This will unregister from server
    delete acc;

    // This will implicitly shutdown the library
    return 0;
}

Here is the output of make command:

Scanning dependencies of target ssc

[ 50%] Building CXX object CMakeFiles/ssc.dir/main.cpp.o

[100%] Linking CXX executable ssc

/usr/bin/ld: /usr/local/lib/libpjmedia-codec-x86_64-unknown-linux-gnu.a(gsm.o): in function `gsm_codec_open':

gsm.c:(.text+0x86f): undefined reference to `gsm_create'

/usr/bin/ld: gsm.c:(.text+0x88e): undefined reference to `gsm_create'

/usr/bin/ld: /usr/local/lib/libpjmedia-codec-x86_64-unknown-linux-gnu.a(gsm.o): in function `gsm_codec_close':

gsm.c:(.text+0x93e): undefined reference to `gsm_destroy'

/usr/bin/ld: gsm.c:(.text+0x966): undefined reference to `gsm_destroy'

/usr/bin/ld: /usr/local/lib/libpjmedia-codec-x86_64-unknown-linux-gnu.a(gsm.o): in function `gsm_codec_encode':

gsm.c:(.text+0xdc8): undefined reference to `gsm_encode'

/usr/bin/ld: /usr/local/lib/libpjmedia-codec-x86_64-unknown-linux-gnu.a(gsm.o): in function `gsm_codec_decode':

gsm.c:(.text+0xef0): undefined reference to `gsm_decode'

/usr/bin/ld: /usr/local/lib/libpjmedia-codec-x86_64-unknown-linux-gnu.a(speex_codec.o): in function `get_speex_info':

speex_codec.c:(.text+0xf6): undefined reference to `speex_encoder_init'

/usr/bin/ld: speex_codec.c:(.text+0x130): undefined reference to `speex_encoder_ctl'

/usr/bin/ld: speex_codec.c:(.text+0x149): undefined reference to `speex_encoder_ctl'

/usr/bin/ld: speex_codec.c:(.text+0x165): undefined reference to `speex_encoder_ctl'

/usr/bin/ld: speex_codec.c:(.text+0x18a): undefined reference to `speex_encoder_ctl'

/usr/bin/ld: speex_codec.c:(.text+0x1a3): undefined reference to `speex_encoder_ctl'

/usr/bin/ld: /usr/local/lib/libpjmedia-codec-x86_64-unknown-linux-gnu.a(speex_codec.o):speex_codec.c:(.text+0x1bc): more undefined references to `speex_encoder_ctl' follow

/usr/bin/ld: /usr/local/lib/libpjmedia-codec-x86_64-unknown-linux-gnu.a(speex_codec.o): in function `get_speex_info':

speex_codec.c:(.text+0x221): undefined reference to `speex_encoder_destroy'

/usr/bin/ld: /usr/local/lib/libpjmedia-codec-x86_64-unknown-linux-gnu.a(speex_codec.o): in function `pjmedia_codec_speex_init':

speex_codec.c:(.text+0x3a8): undefined reference to `speex_nb_mode'

/usr/bin/ld: speex_codec.c:(.text+0x3f3): undefined reference to `speex_lib_get_mode'

/usr/bin/ld: speex_codec.c:(.text+0x43e): undefined reference to `speex_lib_get_mode'

/usr/bin/ld: /usr/local/lib/libpjmedia-codec-x86_64-unknown-linux-gnu.a(speex_codec.o): in function `spx_codec_open':

speex_codec.c:(.text+0xf28): undefined reference to `speex_encoder_init'

/usr/bin/ld: speex_codec.c:(.text+0xf57): undefined reference to `speex_bits_init'

/usr/bin/ld: speex_codec.c:(.text+0xfb6): undefined reference to `speex_encoder_ctl'

/usr/bin/ld: speex_codec.c:(.text+0xff9): undefined reference to `speex_encoder_ctl'

/usr/bin/ld: speex_codec.c:(.text+0x1028): undefined reference to `speex_encoder_ctl'

/usr/bin/ld: speex_codec.c:(.text+0x1041): undefined reference to `speex_encoder_ctl'

/usr/bin/ld: speex_codec.c:(.text+0x10a0): undefined reference to `speex_encoder_ctl'

/usr/bin/ld: speex_codec.c:(.text+0x10c9): undefined reference to `speex_decoder_init'

/usr/bin/ld: speex_codec.c:(.text+0x1101): undefined reference to `speex_bits_init'

/usr/bin/ld: speex_codec.c:(.text+0x113b): undefined reference to `speex_decoder_ctl'

/usr/bin/ld: speex_codec.c:(.text+0x1168): undefined reference to `speex_decoder_ctl'

/usr/bin/ld: /usr/local/lib/libpjmedia-codec-x86_64-unknown-linux-gnu.a(speex_codec.o): in function `spx_codec_close':

speex_codec.c:(.text+0x11a4): undefined reference to `speex_encoder_destroy'

/usr/bin/ld: speex_codec.c:(.text+0x11c0): undefined reference to `speex_bits_destroy'

/usr/bin/ld: speex_codec.c:(.text+0x11dd): undefined reference to `speex_decoder_destroy'

/usr/bin/ld: speex_codec.c:(.text+0x11f9): undefined reference to `speex_bits_destroy'

/usr/bin/ld: /usr/local/lib/libpjmedia-codec-x86_64-unknown-linux-gnu.a(speex_codec.o): in function `spx_codec_modify':

speex_codec.c:(.text+0x124b): undefined reference to `speex_encoder_ctl'

/usr/bin/ld: speex_codec.c:(.text+0x1264): undefined reference to `speex_encoder_ctl'

/usr/bin/ld: speex_codec.c:(.text+0x1291): undefined reference to `speex_decoder_ctl'

/usr/bin/ld: /usr/local/lib/libpjmedia-codec-x86_64-unknown-linux-gnu.a(speex_codec.o): in function `speex_get_next_frame':

speex_codec.c:(.text+0x12de): undefined reference to `speex_bits_unpack_unsigned'

/usr/bin/ld: speex_codec.c:(.text+0x131e): undefined reference to `speex_bits_advance'

/usr/bin/ld: speex_codec.c:(.text+0x1352): undefined reference to `speex_bits_remaining'

/usr/bin/ld: speex_codec.c:(.text+0x1368): undefined reference to `speex_bits_unpack_unsigned'

/usr/bin/ld: speex_codec.c:(.text+0x137c): undefined reference to `speex_bits_remaining'

/usr/bin/ld: speex_codec.c:(.text+0x13c0): undefined reference to `speex_bits_unpack_unsigned'

/usr/bin/ld: speex_codec.c:(.text+0x13ea): undefined reference to `speex_bits_unpack_unsigned'

/usr/bin/ld: speex_codec.c:(.text+0x1410): undefined reference to `speex_bits_advance'

/usr/bin/ld: speex_codec.c:(.text+0x142c): undefined reference to `speex_bits_unpack_unsigned'

/usr/bin/ld: speex_codec.c:(.text+0x1445): undefined reference to `speex_bits_advance'

/usr/bin/ld: speex_codec.c:(.text+0x146d): undefined reference to `speex_nb_mode'

/usr/bin/ld: speex_codec.c:(.text+0x1475): undefined reference to `speex_mode_query'

/usr/bin/ld: speex_codec.c:(.text+0x149d): undefined reference to `speex_bits_advance'

/usr/bin/ld: speex_codec.c:(.text+0x14ad): undefined reference to `speex_bits_remaining'

/usr/bin/ld: /usr/local/lib/libpjmedia-codec-x86_64-unknown-linux-gnu.a(speex_codec.o): in function `spx_codec_parse':

speex_codec.c:(.text+0x1541): undefined reference to `speex_bits_read_from'

/usr/bin/ld: /usr/local/lib/libpjmedia-codec-x86_64-unknown-linux-gnu.a(speex_codec.o): in function `spx_codec_encode':

speex_codec.c:(.text+0x17b2): undefined reference to `speex_bits_reset'

/usr/bin/ld: speex_codec.c:(.text+0x17d3): undefined reference to `speex_encode_int'

/usr/bin/ld: speex_codec.c:(.text+0x183f): undefined reference to `speex_bits_nbytes'

/usr/bin/ld: speex_codec.c:(.text+0x1883): undefined reference to `speex_bits_write'

/usr/bin/ld: /usr/local/lib/libpjmedia-codec-x86_64-unknown-linux-gnu.a(speex_codec.o): in function `spx_codec_decode':

speex_codec.c:(.text+0x19af): undefined reference to `speex_bits_read_from'

/usr/bin/ld: speex_codec.c:(.text+0x19ca): undefined reference to `speex_bits_advance'

/usr/bin/ld: speex_codec.c:(.text+0x19ed): undefined reference to `speex_decode_int'

/usr/bin/ld: /usr/local/lib/libpjmedia-codec-x86_64-unknown-linux-gnu.a(speex_codec.o): in function `spx_codec_recover':

speex_codec.c:(.text+0x1ac2): undefined reference to `speex_decode_int'

/usr/bin/ld: /usr/local/lib/libpjmedia-codec-x86_64-unknown-linux-gnu.a(ilbc.o): in function `ilbc_codec_open':

ilbc.c:(.text+0xa91): undefined reference to `initEncode'

/usr/bin/ld: ilbc.c:(.text+0xae6): undefined reference to `initDecode'

/usr/bin/ld: /usr/local/lib/libpjmedia-codec-x86_64-unknown-linux-gnu.a(ilbc.o): in function `ilbc_codec_encode':

ilbc.c:(.text+0x106d): undefined reference to `iLBC_encode'

/usr/bin/ld: /usr/local/lib/libpjmedia-codec-x86_64-unknown-linux-gnu.a(ilbc.o): in function `ilbc_codec_decode':

ilbc.c:(.text+0x11c6): undefined reference to `iLBC_decode'

/usr/bin/ld: /usr/local/lib/libpjmedia-codec-x86_64-unknown-linux-gnu.a(ilbc.o): in function `ilbc_codec_recover':

ilbc.c:(.text+0x12fe): undefined reference to `iLBC_decode'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(resample_resample.o): in function `pjmedia_resample_create':

resample_resample.c:(.text+0x29e): undefined reference to `res_GetXOFF'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(resample_resample.o): in function `pjmedia_resample_run':

resample_resample.c:(.text+0x42b): undefined reference to `res_Resample'

/usr/bin/ld: resample_resample.c:(.text+0x4ab): undefined reference to `res_SrcLinear'

/usr/bin/ld: resample_resample.c:(.text+0x516): undefined reference to `res_SrcLinear'

/usr/bin/ld: resample_resample.c:(.text+0x57d): undefined reference to `res_Resample'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(transport_srtp.o): in function `transport_send_rtcp2':

transport_srtp.c:(.text+0x632): undefined reference to `srtp_protect_rtcp'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(transport_srtp.o): in function `transport_send_rtp':

transport_srtp.c:(.text+0x728): undefined reference to `srtp_protect'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(transport_srtp.o): in function `transport_get_info':

transport_srtp.c:(.text+0x156a): undefined reference to `srtp_get_stream_roc'

/usr/bin/ld: transport_srtp.c:(.text+0x1582): undefined reference to `srtp_get_stream_roc'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(transport_srtp.o): in function `pjmedia_srtp_deinit_lib':

transport_srtp.c:(.text+0x15d3): undefined reference to `srtp_shutdown'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(transport_srtp.o): in function `pjmedia_transport_srtp_stop.part.0':

transport_srtp.c:(.text+0x1672): undefined reference to `srtp_dealloc'

/usr/bin/ld: transport_srtp.c:(.text+0x168a): undefined reference to `srtp_dealloc'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(transport_srtp.o): in function `srtp_rtcp_cb':

transport_srtp.c:(.text+0x1ce3): undefined reference to `srtp_unprotect_rtcp'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(transport_srtp.o): in function `pjmedia_srtp_init_lib':

transport_srtp.c:(.text+0x24f4): undefined reference to `srtp_init'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(transport_srtp.o): in function `pjmedia_transport_srtp_start':

transport_srtp.c:(.text+0x3072): undefined reference to `srtp_create'

/usr/bin/ld: transport_srtp.c:(.text+0x328c): undefined reference to `srtp_create'

/usr/bin/ld: transport_srtp.c:(.text+0x3762): undefined reference to `srtp_dealloc'

/usr/bin/ld: transport_srtp.c:(.text+0x3783): undefined reference to `srtp_set_stream_roc'

/usr/bin/ld: transport_srtp.c:(.text+0x37ea): undefined reference to `srtp_set_stream_roc'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(transport_srtp.o): in function `srtp_rtp_cb':

transport_srtp.c:(.text+0x3933): undefined reference to `srtp_unprotect'

/usr/bin/ld: transport_srtp.c:(.text+0x3bb1): undefined reference to `srtp_unprotect'

/usr/bin/ld: transport_srtp.c:(.text+0x3c3b): undefined reference to `srtp_get_stream_roc'

/usr/bin/ld: transport_srtp.c:(.text+0x3c61): undefined reference to `srtp_set_stream_roc'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(transport_srtp.o): in function `pjmedia_transport_srtp_decrypt_pkt':

transport_srtp.c:(.text+0x40d1): undefined reference to `srtp_unprotect'

/usr/bin/ld: transport_srtp.c:(.text+0x4101): undefined reference to `srtp_unprotect_rtcp'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(transport_srtp.o):(.data.rel.ro+0x68): undefined reference to `srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(transport_srtp.o):(.data.rel.ro+0xa0): undefined reference to `srtp_crypto_policy_set_aes_cm_256_hmac_sha1_32'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(echo_webrtc.o): in function `set_config':

echo_webrtc.c:(.text+0x41): undefined reference to `WebRtcAec_set_config'

/usr/bin/ld: echo_webrtc.c:(.text+0x6c): undefined reference to `WebRtcAec_get_error_code'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(echo_webrtc.o): in function `webrtc_aec_create':

echo_webrtc.c:(.text+0x128): undefined reference to `WebRtcAec_Create'

/usr/bin/ld: echo_webrtc.c:(.text+0x140): undefined reference to `WebRtcAec_Init'

/usr/bin/ld: echo_webrtc.c:(.text+0x153): undefined reference to `WebRtcAec_aec_core'

/usr/bin/ld: echo_webrtc.c:(.text+0x160): undefined reference to `WebRtcAec_enable_delay_agnostic'

/usr/bin/ld: echo_webrtc.c:(.text+0x1d1): undefined reference to `WebRtcAec_get_error_code'

/usr/bin/ld: echo_webrtc.c:(.text+0x1ec): undefined reference to `WebRtcAec_Free'

/usr/bin/ld: echo_webrtc.c:(.text+0x21b): undefined reference to `WebRtcNs_Create'

/usr/bin/ld: echo_webrtc.c:(.text+0x22e): undefined reference to `WebRtcNs_Init'

/usr/bin/ld: echo_webrtc.c:(.text+0x285): undefined reference to `WebRtcNs_Free'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(echo_webrtc.o): in function `webrtc_aec_destroy':

echo_webrtc.c:(.text+0x2f2): undefined reference to `WebRtcAec_Free'

/usr/bin/ld: echo_webrtc.c:(.text+0x307): undefined reference to `WebRtcNs_Free'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(echo_webrtc.o): in function `webrtc_aec_reset':

echo_webrtc.c:(.text+0x35c): undefined reference to `WebRtcAec_Init'

/usr/bin/ld: echo_webrtc.c:(.text+0x3ac): undefined reference to `WebRtcAec_get_error_code'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(echo_webrtc.o): in function `webrtc_aec_cancel_echo':

echo_webrtc.c:(.text+0x4c3): undefined reference to `WebRtcAec_BufferFarend'

/usr/bin/ld: echo_webrtc.c:(.text+0x4ef): undefined reference to `WebRtcNs_Analyze'

/usr/bin/ld: echo_webrtc.c:(.text+0x526): undefined reference to `WebRtcAec_Process'

/usr/bin/ld: echo_webrtc.c:(.text+0x559): undefined reference to `WebRtcNs_Process'

/usr/bin/ld: echo_webrtc.c:(.text+0x5eb): undefined reference to `WebRtcAec_get_error_code'

/usr/bin/ld: echo_webrtc.c:(.text+0x614): undefined reference to `WebRtcAec_get_error_code'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(echo_webrtc.o): in function `webrtc_aec_get_stat':

echo_webrtc.c:(.text+0x6a0): undefined reference to `WebRtcAec_GetDelayMetrics'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(echo_speex.o): in function `speex_aec_destroy':

echo_speex.c:(.text+0x15): undefined reference to `speex_echo_state_destroy'

/usr/bin/ld: echo_speex.c:(.text+0x2a): undefined reference to `speex_decorrelate_destroy'

/usr/bin/ld: echo_speex.c:(.text+0x5d): undefined reference to `speex_preprocess_state_destroy'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(echo_speex.o): in function `speex_aec_create':

echo_speex.c:(.text+0x12b): undefined reference to `speex_echo_state_init_mc'

/usr/bin/ld: echo_speex.c:(.text+0x146): undefined reference to `speex_decorrelate_new'

/usr/bin/ld: echo_speex.c:(.text+0x16a): undefined reference to `speex_echo_ctl'

/usr/bin/ld: echo_speex.c:(.text+0x1c1): undefined reference to `speex_preprocess_ctl'

/usr/bin/ld: echo_speex.c:(.text+0x1db): undefined reference to `speex_preprocess_ctl'

/usr/bin/ld: echo_speex.c:(.text+0x1f0): undefined reference to `speex_preprocess_ctl'

/usr/bin/ld: echo_speex.c:(.text+0x20e): undefined reference to `speex_preprocess_state_init'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(echo_speex.o): in function `speex_aec_cancel_echo':

echo_speex.c:(.text+0x34b): undefined reference to `speex_echo_cancellation'

/usr/bin/ld: echo_speex.c:(.text+0x37c): undefined reference to `speex_preprocess_run'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(echo_speex.o): in function `speex_aec_playback':

echo_speex.c:(.text+0x443): undefined reference to `speex_echo_playback'

/usr/bin/ld: echo_speex.c:(.text+0x490): undefined reference to `speex_decorrelate'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(echo_speex.o): in function `speex_aec_capture':

echo_speex.c:(.text+0x508): undefined reference to `speex_echo_capture'

/usr/bin/ld: echo_speex.c:(.text+0x53d): undefined reference to `speex_preprocess_run'

/usr/bin/ld: /usr/local/lib/libpjmedia-x86_64-unknown-linux-gnu.a(echo_speex.o): in function `speex_aec_reset':

echo_speex.c:(.text+0x2a4): undefined reference to `speex_echo_state_reset'

collect2: error: ld returned 1 exit status

make[2]: *** [CMakeFiles/ssc.dir/build.make:106: ssc] Error 1

make[1]: *** [CMakeFiles/Makefile2:95: CMakeFiles/ssc.dir/all] Error 2

make: *** [Makefile:103: all] Error 2

When I'm trying to build project by running g++ main.cpp $(pkg-config --cflags --libs --static libpjproject) then everything is ok. But I need to be able to build it from cmake. Any ideas of how to change cmake file or configure pjsip lib in order to be able to build it from cmake?

rudolfninja
  • 467
  • 7
  • 24
  • You don't show your code in the question, as text, so how can we answer? Code behind links cannot be accessed by all users. Code in images cannot be accessed by all users. Everything required to understand the question and provide an answer should be *in* the question, as *text*. – Jesper Juhl Jun 08 '23 at 20:11
  • sorry, didn't know that not all users cannot access code behind the link. Added code in the question – rudolfninja Jun 08 '23 at 20:16
  • Isn't is fairly obvious that for example blind users can't read images but can get something from text? There are also users with other disabillities that appeciate text. – Jesper Juhl Jun 08 '23 at 20:19
  • 1
    While in many cases consuming `_LIBRARIES` and `_LIBRARY_DIRS` variables is sufficient to "reproduce" full linking effect of `pkg-config`, sometimes `_LDFLAGS` and `_LDFLAGS_OTHER` variables should also be consumed for the desired effect. There is more convenient way for consume `pkg_check_modules` result - IMPORTED_TARGET, as described in [that answer](https://stackoverflow.com/a/57224542/3440745). Have you tried it? – Tsyvarev Jun 08 '23 at 21:09
  • 2
    Note also, that for "reproduce" `pkg-config` with `--static` parameter, instead of variables prefixed `PJSIP_` one should use `PJSIP_STATIC_`-prefixed variables instead: `PJSIP_STATIC_LIBRARIES`, `PJSIP_STATIC_LIBRARY_DIRS`, etc. This is noted in the [documentation](https://cmake.org/cmake/help/latest/module/FindPkgConfig.html). But IMPORTED_TARGET seems to create the only target corresponding to non-static variant. – Tsyvarev Jun 08 '23 at 21:12
  • 1
    using PJSIP_STATIC_ prefixes solves the problem. Thanks! – rudolfninja Jun 09 '23 at 06:10

0 Answers0