https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d0ed4fdb3a14fd4d571fc…
commit d0ed4fdb3a14fd4d571fc266b27291b03a17aaa4
Author:     Jérôme Gardou <jerome.gardou(a)reactos.org>
AuthorDate: Tue Oct 20 09:05:47 2020 +0200
Commit:     Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Tue Oct 20 15:21:00 2020 +0200
    [CMAKE] Fix generation of UTF-16 inf file
---
 media/themes/Lautus/lautus.msstyles/CMakeLists.txt | 11 +++++------
 media/themes/Lunar/lunar.msstyles/CMakeLists.txt   | 11 +++++------
 media/themes/Mizu/mizu.msstyles/CMakeLists.txt     | 11 +++++------
 media/themes/Modern/modern.msstyles/CMakeLists.txt | 11 +++++------
 sdk/cmake/CMakeMacros.cmake                        |  5 +++--
 5 files changed, 23 insertions(+), 26 deletions(-)
diff --git a/media/themes/Lautus/lautus.msstyles/CMakeLists.txt
b/media/themes/Lautus/lautus.msstyles/CMakeLists.txt
index 01d26935a14..0f0971f9c55 100644
--- a/media/themes/Lautus/lautus.msstyles/CMakeLists.txt
+++ b/media/themes/Lautus/lautus.msstyles/CMakeLists.txt
@@ -7,13 +7,12 @@ list(APPEND TEXTFILES
 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/textfiles)
 foreach(_file ${TEXTFILES})
     get_filename_component(_file_name ${_file} NAME_WE)
-    string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} _converted_file
"${_file}")
-    string(REPLACE ${_file_name} "${_file_name}_utf16" _converted_file
${_converted_file})
-    set(_file ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
-    set(_converted_file ${CMAKE_CURRENT_BINARY_DIR}/${_converted_file})
+    get_filename_component(_subdir ${_file} DIRECTORY)
+    file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_subdir})
+    set(_converted_file ${CMAKE_CURRENT_BINARY_DIR}/${_subdir}/${_file_name}_utf16.INI)
     add_custom_command(OUTPUT ${_converted_file}
-                       COMMAND native-utf16le ${_file} ${_converted_file}
-                       DEPENDS native-utf16le ${_file})
+                       COMMAND native-utf16le ${CMAKE_CURRENT_SOURCE_DIR}/${_file}
${_converted_file}
+                       DEPENDS native-utf16le ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
     list(APPEND _converted_files ${_converted_file})
 endforeach()
diff --git a/media/themes/Lunar/lunar.msstyles/CMakeLists.txt
b/media/themes/Lunar/lunar.msstyles/CMakeLists.txt
index 72d1b86d37f..60deacfd57b 100644
--- a/media/themes/Lunar/lunar.msstyles/CMakeLists.txt
+++ b/media/themes/Lunar/lunar.msstyles/CMakeLists.txt
@@ -7,13 +7,12 @@ list(APPEND TEXTFILES
 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/textfiles)
 foreach(_file ${TEXTFILES})
     get_filename_component(_file_name ${_file} NAME_WE)
-    string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} _converted_file
"${_file}")
-    string(REPLACE ${_file_name} "${_file_name}_utf16" _converted_file
${_converted_file})
-    set(_file ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
-    set(_converted_file ${CMAKE_CURRENT_BINARY_DIR}/${_converted_file})
+    get_filename_component(_subdir ${_file} DIRECTORY)
+    file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_subdir})
+    set(_converted_file ${CMAKE_CURRENT_BINARY_DIR}/${_subdir}/${_file_name}_utf16.INI)
     add_custom_command(OUTPUT ${_converted_file}
-                       COMMAND native-utf16le ${_file} ${_converted_file}
-                       DEPENDS native-utf16le ${_file})
+                       COMMAND native-utf16le ${CMAKE_CURRENT_SOURCE_DIR}/${_file}
${_converted_file}
+                       DEPENDS native-utf16le ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
     list(APPEND _converted_files ${_converted_file})
 endforeach()
diff --git a/media/themes/Mizu/mizu.msstyles/CMakeLists.txt
b/media/themes/Mizu/mizu.msstyles/CMakeLists.txt
index 51f65c31bd2..f2e264c045a 100644
--- a/media/themes/Mizu/mizu.msstyles/CMakeLists.txt
+++ b/media/themes/Mizu/mizu.msstyles/CMakeLists.txt
@@ -7,13 +7,12 @@ list(APPEND TEXTFILES
 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/textfiles)
 foreach(_file ${TEXTFILES})
     get_filename_component(_file_name ${_file} NAME_WE)
-    string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} _converted_file
"${_file}")
-    string(REPLACE ${_file_name} "${_file_name}_utf16" _converted_file
${_converted_file})
-    set(_file ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
-    set(_converted_file ${CMAKE_CURRENT_BINARY_DIR}/${_converted_file})
+    get_filename_component(_subdir ${_file} DIRECTORY)
+    file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_subdir})
+    set(_converted_file ${CMAKE_CURRENT_BINARY_DIR}/${_subdir}/${_file_name}_utf16.INI)
     add_custom_command(OUTPUT ${_converted_file}
-                       COMMAND native-utf16le ${_file} ${_converted_file}
-                       DEPENDS native-utf16le ${_file})
+                       COMMAND native-utf16le ${CMAKE_CURRENT_SOURCE_DIR}/${_file}
${_converted_file}
+                       DEPENDS native-utf16le ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
     list(APPEND _converted_files ${_converted_file})
 endforeach()
diff --git a/media/themes/Modern/modern.msstyles/CMakeLists.txt
b/media/themes/Modern/modern.msstyles/CMakeLists.txt
index 6a1be70e14a..2b2fb43bd2c 100644
--- a/media/themes/Modern/modern.msstyles/CMakeLists.txt
+++ b/media/themes/Modern/modern.msstyles/CMakeLists.txt
@@ -12,13 +12,12 @@ list(APPEND TEXTFILES
 file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/textfiles)
 foreach(_file ${TEXTFILES})
     get_filename_component(_file_name ${_file} NAME_WE)
-    string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} _converted_file
"${_file}")
-    string(REPLACE ${_file_name} "${_file_name}_utf16" _converted_file
${_converted_file})
-    set(_file ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
-    set(_converted_file ${CMAKE_CURRENT_BINARY_DIR}/${_converted_file})
+    get_filename_component(_subdir ${_file} DIRECTORY)
+    file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_subdir})
+    set(_converted_file ${CMAKE_CURRENT_BINARY_DIR}/${_subdir}/${_file_name}_utf16.INI)
     add_custom_command(OUTPUT ${_converted_file}
-                       COMMAND native-utf16le ${_file} ${_converted_file}
-                       DEPENDS native-utf16le ${_file})
+                       COMMAND native-utf16le ${CMAKE_CURRENT_SOURCE_DIR}/${_file}
${_converted_file}
+                       DEPENDS native-utf16le ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
     list(APPEND _converted_files ${_converted_file})
 endforeach()
diff --git a/sdk/cmake/CMakeMacros.cmake b/sdk/cmake/CMakeMacros.cmake
index 5ac5dec5555..fa408d7d631 100644
--- a/sdk/cmake/CMakeMacros.cmake
+++ b/sdk/cmake/CMakeMacros.cmake
@@ -821,8 +821,9 @@ function(create_registry_hives)
     # Convert files to utf16le
     foreach(_file ${_inf_files})
         get_filename_component(_file_name ${_file} NAME_WE)
-        string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} _converted_file
"${_file}")
-        string(REPLACE ${_file_name} "${_file_name}_utf16" _converted_file
${_converted_file})
+        file(RELATIVE_PATH _subdir ${CMAKE_SOURCE_DIR} ${_file})
+        get_filename_component(_subdir ${_subdir}  DIRECTORY)
+        set(_converted_file ${CMAKE_BINARY_DIR}/${_subdir}/${_file_name}_utf16.inf)
         add_custom_command(OUTPUT ${_converted_file}
                            COMMAND native-utf16le ${_file} ${_converted_file}
                            DEPENDS native-utf16le ${_file})