How to create iOS Framework with c++ sources and static libraries

Viewed 588

I have c++ source code and some 3rd parties static libraries, which code is using. And I have a simple iOS application, which runs this code. Basically, there are such modules:

  1. ios app
  2. my_lib.a
  3. 3rd party static libs

And dependencies: ios_app -> my_lib.a -> 3rd party static libs

Everything works as expected.

Now I want to create an iOS Framework, which would have my_lib.a and 3rd_party.a, and ios_app would use it. What I'm doing:

add_library (my_lib SHARED "")
target_sources(my_lib PRIVATE _my_source_files_)
set_target_properties(my_lib PROPERTIES FRAMEWORK TRUE _OTHER_KEYS_)
target_link_libraries (my_lib _3rd_party_libs)

Then I build Framework and check, what it has with command: nm -gU my_framework.framework/my_framework The thing is, that id does not show symbols from my source file, but only from 3rd party libraries. As a result, when using such framework, I'm getting compilation error 'symbol not found for architecture ...'

On the other hand, if I declare my framework as 'static':

add_library (my_lib SHARED "")

But after that I did not see all those 3rd party libraries in output, but see symbols from my sources.

I have googled and did not find any answers or examples. May be I am missing something?

1 Answers
Related