Reputation: 325
I have a CMake (3.12.2) project that generates an iOS Xcode project. And I managed to configure almost everything I need via CMake, except one thing: the Copy Bundle Resources phase.
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?
Upvotes: 4
Views: 2498
Reputation: 31
keyword: RESOURCE
https://cmake.org/cmake/help/latest/prop_tgt/RESOURCE.html
add_executable(ExecutableTarget addDemo.c resourcefile.txt
appresourcedir/appres.txt )target_link_libraries(ExecutableTarget heymath mul)
set(RESOURCE_FILES resourcefile.txt appresourcedir/appres.txt )
set_target_properties(ExecutableTarget PROPERTIES MACOSX_BUNDLE TRUE MACOSX_FRAMEWORK_IDENTIFIER org.cmake.ExecutableTarget RESOURCE "${RESOURCE_FILES}" )
Upvotes: 3
Reputation: 959
set(png_path "${YOUR_PNG_DIR}/test.png")
target_sources(${TARGET} PUBLIC ${png_path})
set_source_files_properties(${png_path} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
YOUR_PNG_DIR can be a cmake macro
Upvotes: 4