0
|
1 set(AUTOGENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/AUTOGENERATED")
|
|
2 set(AUTOGENERATED_SOURCES)
|
|
3
|
|
4 file(MAKE_DIRECTORY ${AUTOGENERATED_DIR})
|
|
5 include_directories(${AUTOGENERATED_DIR})
|
|
6
|
|
7 macro(EmbedResources)
|
|
8 # Convert a semicolon separated list to a whitespace separated string
|
|
9 set(SCRIPT_ARGUMENTS)
|
|
10 set(DEPENDENCIES)
|
|
11 set(IS_PATH_NAME false)
|
|
12 foreach(arg ${ARGN})
|
|
13 if (${IS_PATH_NAME})
|
|
14 list(APPEND SCRIPT_ARGUMENTS "${CMAKE_CURRENT_SOURCE_DIR}/${arg}")
|
|
15 list(APPEND DEPENDENCIES "${CMAKE_CURRENT_SOURCE_DIR}/${arg}")
|
|
16 set(IS_PATH_NAME false)
|
|
17 else()
|
|
18 list(APPEND SCRIPT_ARGUMENTS "${arg}")
|
|
19 set(IS_PATH_NAME true)
|
|
20 endif()
|
|
21 endforeach()
|
|
22
|
|
23 set(TARGET_BASE "${AUTOGENERATED_DIR}/EmbeddedResources")
|
|
24 add_custom_command(
|
|
25 OUTPUT
|
|
26 "${TARGET_BASE}.h"
|
|
27 "${TARGET_BASE}.cpp"
|
|
28 COMMAND
|
|
29 python
|
|
30 "${CMAKE_CURRENT_SOURCE_DIR}/Resources/EmbedResources.py"
|
|
31 "${AUTOGENERATED_DIR}/EmbeddedResources"
|
|
32 ${SCRIPT_ARGUMENTS}
|
|
33 DEPENDS
|
|
34 "${CMAKE_CURRENT_SOURCE_DIR}/Resources/EmbedResources.py"
|
|
35 ${DEPENDENCIES}
|
|
36 )
|
|
37
|
|
38 list(APPEND AUTOGENERATED_SOURCES
|
|
39 "${AUTOGENERATED_DIR}/EmbeddedResources.cpp"
|
|
40 )
|
|
41 endmacro()
|