|
|
@ -5,15 +5,19 @@ function(generate_resources target)
|
|
|
|
PROPERTY SOURCES
|
|
|
|
PROPERTY SOURCES
|
|
|
|
)
|
|
|
|
)
|
|
|
|
foreach(SOURCE ${TARGET_SOURCES})
|
|
|
|
foreach(SOURCE ${TARGET_SOURCES})
|
|
|
|
if(SOURCE MATCHES ".cmake$")
|
|
|
|
|
|
|
|
get_filename_component(RESOURCE_NAME "${SOURCE}" NAME_WE)
|
|
|
|
get_filename_component(RESOURCE_NAME "${SOURCE}" NAME_WE)
|
|
|
|
set(RESOURCE_HEADER "include/resources/${RESOURCE_NAME}.hpp")
|
|
|
|
set(RESOURCE_HEADER "include/resources/${RESOURCE_NAME}.hpp")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(SOURCE MATCHES ".cmake$")
|
|
|
|
# Add configure-time dependency on the source file
|
|
|
|
# Add configure-time dependency on the source file
|
|
|
|
configure_file("${SOURCE}" "${RESOURCE_HEADER}" COPYONLY)
|
|
|
|
configure_file("${SOURCE}" "${RESOURCE_HEADER}" COPYONLY)
|
|
|
|
# Generate the actual resource into the header
|
|
|
|
# Generate the actual resource into the header
|
|
|
|
file(READ "${SOURCE}" RESOURCE_CONTENTS)
|
|
|
|
file(READ "${SOURCE}" RESOURCE_CONTENTS)
|
|
|
|
configure_file("${PROJECT_SOURCE_DIR}/cmake/resource.hpp.in" "${RESOURCE_HEADER}" @ONLY)
|
|
|
|
configure_file("${PROJECT_SOURCE_DIR}/cmake/resource.hpp.in" "${RESOURCE_HEADER}" @ONLY)
|
|
|
|
message(STATUS "[cmkr] Generated ${RESOURCE_HEADER}")
|
|
|
|
message(STATUS "[cmkr] Generated ${RESOURCE_HEADER}")
|
|
|
|
|
|
|
|
elseif(SOURCE MATCHES ".in$")
|
|
|
|
|
|
|
|
configure_file("${SOURCE}" "${RESOURCE_HEADER}" @ONLY)
|
|
|
|
|
|
|
|
message(STATUS "[cmkr] Generated ${RESOURCE_HEADER}")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endforeach()
|
|
|
|
target_include_directories(${target} PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include")
|
|
|
|
target_include_directories(${target} PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include")
|
|
|
|