JUCE icon indicating copy to clipboard operation
JUCE copied to clipboard

CMake: Allow generated files to be included in juce_add_binary_data

Open piem opened this issue 3 years ago • 1 comments

This trivial patch allows one to include generated files in the list of SOURCES of juce_add_binary_data.

Example:

# create a zip of dir foo/
add_custom_command(COMMAND
    ${CMAKE_COMMAND} -E tar "cfv" "foo.zip" --format=zip
    "${CMAKE_CURRENT_DIRECTORY}/foo/"
)
# create a custom target for it
add_custom_target (FooZip DEPENDS "foo.zip")
# create juce binary data
juce_add_binary_data(FooData
    NAMESPACE FooData
    HEADER_NAME FooData.h
    SOURCES "${CMAKE_CURRENT_BINARY_DIR}/foo.zip"
)
# let it depend on FooZip target
add_dependencies (FooData FooZip)

Another way to do it would be to add a DEPENDS argument to keep the _and_check on SOURCES, but it doesn't seem required since juceaide will error on missing files anyhow.

cheers, piem

piem avatar Nov 14 '21 21:11 piem

Bump! I would like this feature :-)

benthevining avatar Jan 31 '22 12:01 benthevining