Create a STATIC library with another STATIC library that content inside in iOS using CMake -
i have collection of libfooi.a; libfoo1.a, libfoo2.a, libfoo3.a ... using factories (with static code) have mutual interface create c++ objects.
with cmake take 1 of them, , create libfoowrapper.a link , add together content. using cmake cmakelists.txt works in android:
project(foowrapper) include_directories(___) add_library(foowrapper shared ${src} ${headers} ) # must static in ios if(selected1) target_link_libraries(foowrapper -wl,--whole-archive foo1 -wl,--no-whole-archive) elseif(...) target_link_libraries(foowrapper -wl,--whole-archive foo2 -wl,--no-whole-archive)
a executable app project created manually, link generated foowrapper , work.
but in ios using clang, have changed add_library static, , seek using -wl,--whole-archive doesnt work. have checked documentation of using -obj -wl,-force_load must work. have tried using flag -obj -wl,-all_load.
analysing library libfoowrapper.a otool, seems content libfooi.a no added libfoowrapper.a, need set within avoid alter manually flags in executable app project.
what wrong linking?
for ios, utilize libtool create single static library multiple static libraries:
add_library(foowrapper static ${src} ${headers} ) add_custom_command(target foowrapper post_build command /usr/bin/libtool -static -o $<target_file:foowrapper> $<target_file:foowrapper> $<target_file:foo1> $<target_file:foo2> $<target_file:foo3> )
the post build action merges cmake static library targets foo1, foo2 , foo3 foowrapper. alternatively, can utilize total paths libraries instead of $<target_file:...>
generator expressions.
ios cmake cross-platform static-linking
No comments:
Post a Comment