Using a generated .r file
Closed this issue · 0 comments
In my app I want to generate some .r file foo.r at build time. I've done that, but I've been unable to get add_application
to accept it because it seems to be hardcoded to expect the .r file to be specified by name only and that it will be in the source directory:
if(${f} MATCHES "\\.r$")
add_custom_command(
OUTPUT ${f}.rsrc.bin
COMMAND ${REZ} ${REZ_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${f} ${rez_include_options} -o ${f}.rsrc.bin
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${f})
list(APPEND rsrc_files "${CMAKE_CURRENT_BINARY_DIR}/${f}.rsrc.bin")
list(APPEND rez_files "${f}")
Specifically, this code prepends ${CMAKE_CURRENT_SOURCE_DIR}/
to ${f}
to compute the input path and prepends ${CMAKE_CURRENT_BINARY_DIR}/
to ${f}
to compute the output path. It doesn't account for ${f}
possibly being an absolute path.
I tried giving add_application
the foo.r filename only, which didn't work because the file isn't in the source directory, and I tried giving it ${CMAKE_CURRENT_BINARY_DIR}/foo.r
which didn't work because ${CMAKE_CURRENT_BINARY_DIR}
is an absolute path and the output filename referred to a nonsensical nonexistent path.
Can I accomplish what I want?