Juce_add_bundle_resources_directory question

Hey everyone! I have all my resources in the root of the project under /resources folder. I want to be able to add all these files to the app/Contents/Resources, when I specify in cmake

juce_add_bundle_resources_directory(${PROJECT_NAME}
    ${CMAKE_SOURCE_DIR}/Resources)

it just copies (as docs suggest) the entire dir to resources, so I end up having app/Contents/Resources/Resources

The way it was done in projucer before is every file under the resources was explicitly put in Custom Xcode Resource Folders (e.g. resources/icon.png, resources/readme.txt, etc.)
I tried to provide the same file names in the cmake and it doesn’t complain when building, but also ends up not putting anything under the resources, how can I solve this?

You can use a custom function for that, which will glob for images.

I have an example doing exactly that here:

(It’s called add_images_from_directory).

Sorry, I misread the original post. I thought you needed embedded binary resources - I’m not sure what the solution is for bundle resources.

I had the same problem and just copied the CMake function juce_add_bundle_resources_directory from JUCE/extras/Build/CMake/JUCEUtils.cmake into my own CMakeLists.txt and modified it.

# Custom version of juce_add_bundle_resources_directory
# Bundle resources are put in Resources folder instead of subfolder
function (sh_add_bundle_resources_directory target folder)
    _juce_make_absolute (folder)

    if (NOT EXISTS "${folder}")
        message (FATAL_ERROR "Could not find resource folder ${folder}")
    endif ()

    get_filename_component (folder_parent_path "${folder}" DIRECTORY)
    file (GLOB_RECURSE resources RELATIVE "${folder_parent_path}" "${folder}/*")

    foreach (file IN LISTS resources)
        target_sources (${target} PRIVATE "${folder_parent_path}/${file}")
        get_filename_component (resource_parent_path "${file}" DIRECTORY)
        set_source_files_properties ("${folder_parent_path}/${file}" PROPERTIES
                HEADER_FILE_ONLY TRUE
                MACOSX_PACKAGE_LOCATION "Resources")
    endforeach ()
endfunction ()
# //sh_add_bundle_resources_directory

sh_add_bundle_resources_directory (StageHand ${CMAKE_CURRENT_SOURCE_DIR}/Assets/Resources)