我有一个CMake列表文件,它构建了一个我拥有的c ++库,包括5个第三方c ++库,这些库也是使用cmake构建的。该项目构建了一个android .aar库和一个iOS框架。
虽然android可以正常工作,但我发现iOS遇到了问题。我设法建立一个.framework文件,但是它不包含第三方库(正确构建),因此要使用.framework,我最终需要手动将第三方库手动添加到我的App项目中。
我如何告诉CMake必须将.framework文件包含/嵌入/运送这些库?
我目前拥有的是:
...
# libpng
include_directories(${ROOT}/thirdparties/libpng)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/thirdparties/libpng)
set(PNG_PNG_INCLUDE_DIR ${ROOT}/thirdparties/libpng)
set(PNG_LIBRARY png16_static)
set(PNG_SHARED OFF)
set(PNG_TESTS OFF CACHE BOOL "skip tests for libpng")
add_subdirectory(${ROOT}/thirdparties/libpng)
... (almost the same for all third party libraries)
if( IOS )
add_library(myLibrary STATIC ${SOURCES} ${SOURCES_JNI} ${SOURCES_MYSQL} ${PUBLIC_HEADER} ${RESOURCES})
else()
add_library(myLibrary SHARED ${SOURCES} ${SOURCES_JNI} ${SOURCES_MYSQL} ${PUBLIC_HEADER} ${RESOURCES})
endif()
target_link_libraries(myLibrary
hpdfs
png16_static
${mysqlcppconn}
zlibstatic
${CRYPTO_LIBRARY}
${PTHREAD}
)
在此先感谢您的帮助!