diff --git a/meta-oe/recipes-support/libtinyxml2/files/copy_resources_with_tests_in_CMakelists.patch b/meta-oe/recipes-support/libtinyxml2/files/copy_resources_with_tests_in_CMakelists.patch
new file mode 100644
index 000000000..09245ad36
--- /dev/null
+++ b/meta-oe/recipes-support/libtinyxml2/files/copy_resources_with_tests_in_CMakelists.patch
@@ -0,0 +1,30 @@
+The xml files inside the resources are to be used for the
+run of test named xmltest
+they were not getting copied from the source directory to the directory
+where xmltest was installed
+
+fixes the below error when code built with cmake
+./xmltest
+Error opening test file 'dream.xml'.
+Is your working directory the same as where
+the xmltest.cpp and dream.xml file are?
+
+Signed-off-by: Nisha Parrakat <nisha.m.parrakat@bmw.de>
+Signed-off-by: Nisha Parrakat <nishaparrakat@gmail.com>
+
+Upstream-Status: Submitted (https://github.com/leethomason/tinyxml2/pull/902)
+--- a/CMakeLists.txt	2022-03-05 22:00:33.361601287 +0100
++++ b/CMakelist.txt	2022-03-05 22:05:19.953940006 +0100
+@@ -51,6 +51,12 @@
+         WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+     )
+ 
++    # Copy test resources and create test output directory
++    add_custom_command(TARGET xmltest POST_BUILD
++	COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/resources $<TARGET_FILE_DIR:xmltest>/resources
++	COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:xmltest>/resources/out
++	COMMENT "Configuring xmltest resources directory: ${CMAKE_CURRENT_BINARY_DIR}/resources"
++    )
+     set_tests_properties(xmltest PROPERTIES PASS_REGULAR_EXPRESSION ", Fail 0")
+ endif ()
+ 
diff --git a/meta-oe/recipes-support/libtinyxml2/libtinyxml2_9.0.0.bb b/meta-oe/recipes-support/libtinyxml2/libtinyxml2_9.0.0.bb
index 7f205987f..06410ab6e 100644
--- a/meta-oe/recipes-support/libtinyxml2/libtinyxml2_9.0.0.bb
+++ b/meta-oe/recipes-support/libtinyxml2/libtinyxml2_9.0.0.bb
@@ -4,7 +4,9 @@ SECTION = "libs"
 LICENSE = "Zlib"
 LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=135624eef03e1f1101b9ba9ac9b5fffd"
 
-SRC_URI = "git://github.com/leethomason/tinyxml2.git;branch=master;protocol=https"
+SRC_URI = "git://github.com/leethomason/tinyxml2.git;branch=master;protocol=https \
+           file://copy_resources_with_tests_in_CMakelists.patch \
+          "
 
 SRCREV = "1dee28e51f9175a31955b9791c74c430fe13dc82"
 
