summaryrefslogtreecommitdiffstats
path: root/cmake/scripts/common/GenerateVersionedFiles.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/scripts/common/GenerateVersionedFiles.cmake')
-rw-r--r--cmake/scripts/common/GenerateVersionedFiles.cmake35
1 files changed, 35 insertions, 0 deletions
diff --git a/cmake/scripts/common/GenerateVersionedFiles.cmake b/cmake/scripts/common/GenerateVersionedFiles.cmake
new file mode 100644
index 0000000..d54b524
--- /dev/null
+++ b/cmake/scripts/common/GenerateVersionedFiles.cmake
@@ -0,0 +1,35 @@
+include(${CORE_SOURCE_DIR}/cmake/scripts/common/Macros.cmake)
+
+core_find_versions()
+
+# configure_file without dependency tracking
+# configure_file would register additional file dependencies that interfere
+# with the ones from add_custom_command (and the generation would happen twice)
+function(generate_versioned_file _SRC _DEST)
+ file(READ ${CORE_SOURCE_DIR}/${_SRC} file_content)
+ string(CONFIGURE "${file_content}" file_content @ONLY)
+ file(WRITE ${CMAKE_BINARY_DIR}/${_DEST} "${file_content}")
+endfunction()
+
+# add-on xml's
+file(GLOB ADDON_XML_IN_FILE ${CORE_SOURCE_DIR}/addons/*/addon.xml.in)
+
+# remove 'xbmc.json', will be created from 'xbmc/interfaces/json-rpc/schema/CMakeLists.txt'
+list(REMOVE_ITEM ADDON_XML_IN_FILE ${CORE_SOURCE_DIR}/addons/xbmc.json/addon.xml.in)
+
+foreach(loop_var ${ADDON_XML_IN_FILE})
+ list(GET loop_var 0 xml_name)
+
+ string(REPLACE "/addon.xml.in" "" source_dir ${xml_name})
+ string(REPLACE ${CORE_SOURCE_DIR} ${CMAKE_BINARY_DIR} dest_dir ${source_dir})
+ file(MAKE_DIRECTORY ${dest_dir})
+
+ configure_file(${source_dir}/addon.xml.in ${dest_dir}/addon.xml @ONLY)
+
+ unset(source_dir)
+ unset(dest_dir)
+ unset(xml_name)
+endforeach()
+
+
+generate_versioned_file(xbmc/CompileInfo.cpp.in ${CORE_BUILD_DIR}/xbmc/CompileInfo.cpp)