[英]How to add the Copy Bundle Resources phase with CMake in Xcode?
I have a CMake (3.12.2) project that generates an iOS Xcode project.我有一个生成 iOS Xcode 项目的 CMake (3.12.2) 项目。 And I managed to configure almost everything I need via CMake, except one thing: the Copy Bundle Resources phase.
我设法通过 CMake 配置了几乎所有我需要的东西,除了一件事:复制捆绑资源阶段。
I can't find any info on how to do this, though this is a common task.我找不到有关如何执行此操作的任何信息,尽管这是一项常见任务。 And I can't just leave it and add this phase manually every time I re-generate my project.
而且我不能在每次重新生成我的项目时就离开它并手动添加这个阶段。
What to do?该怎么办? Did I miss something obvious?
我错过了一些明显的东西吗?
set(png_path "${YOUR_PNG_DIR}/test.png")设置(png_path“${YOUR_PNG_DIR}/test.png”)
target_sources(${TARGET} PUBLIC ${png_path}) target_sources(${TARGET} PUBLIC ${png_path})
set_source_files_properties(${png_path} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) set_source_files_properties(${png_path} PROPERTIES MACOSX_PACKAGE_LOCATION 资源)
YOUR_PNG_DIR can be a cmake macro YOUR_PNG_DIR 可以是一个 cmake 宏
keyword: RESOURCE关键词:资源
https://cmake.org/cmake/help/latest/prop_tgt/RESOURCE.html https://cmake.org/cmake/help/latest/prop_tgt/RESOURCE.html
add_executable(ExecutableTarget addDemo.c resourcefile.txt
add_executable(ExecutableTarget addDemo.c resourcefile.txt
appresourcedir/appres.txt )appresourcedir/appres.txt )
target_link_libraries(ExecutableTarget heymath mul)
target_link_libraries(ExecutableTarget heymath mul)
set(RESOURCE_FILES resourcefile.txt appresourcedir/appres.txt )
设置(RESOURCE_FILES resourcefile.txt appresourcedir/appres.txt)
set_target_properties(ExecutableTarget PROPERTIES MACOSX_BUNDLE TRUE MACOSX_FRAMEWORK_IDENTIFIER org.cmake.ExecutableTarget RESOURCE "${RESOURCE_FILES}" )
set_target_properties(ExecutableTarget PROPERTIES MACOSX_BUNDLE TRUE MACOSX_FRAMEWORK_IDENTIFIER org.cmake.ExecutableTarget RESOURCE "${RESOURCE_FILES}" )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.