Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-08-11 17:32:19 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-11 17:32:19 +0400
commitbe4ae581fff820cefc21d150080e13f621b99cdd (patch)
tree35fda94428817fb6a776c9dc652cb0e975072923 /build_files
parent81272e28a0da2c654c070540279a8d12f349bcb3 (diff)
simplified data_to_c macro in cmake
Diffstat (limited to 'build_files')
-rw-r--r--build_files/cmake/macros.cmake28
1 files changed, 28 insertions, 0 deletions
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 5a5f02b41fa..af122541ae5 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -744,3 +744,31 @@ macro(data_to_c
DEPENDS ${file_from})
endmacro()
+# same as above but generates the var name and output automatic.
+macro(data_to_c_simple
+ file_from
+ list_to_add)
+
+ # get var name automatic from name
+ get_filename_component(_file_from_only ${file_from} NAME)
+ string(REPLACE "." "_" _file_from_only ${_file_from_only})
+ set(_var_name "datatoc_${_file_from_only}")
+
+ # only to avoid confusion
+ set(_file_to ${file_from}.c)
+
+ list(APPEND ${list_to_add} ${CMAKE_CURRENT_BINARY_DIR}/${_file_to})
+
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file_to}
+ COMMAND ${CMAKE_COMMAND}
+ -DFILE_FROM=${CMAKE_CURRENT_SOURCE_DIR}/${file_from}
+ -DFILE_TO=${CMAKE_CURRENT_BINARY_DIR}/${_file_to}
+ -DVAR_NAME=${_var_name}
+ -P ${CMAKE_SOURCE_DIR}/build_files/cmake/data_to_c.cmake
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${file_from})
+
+ unset(_file_from_only)
+ unset(_var_name)
+ unset(_file_to)
+endmacro()