From d0ed4fdb3a14fd4d571fc266b27291b03a17aaa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Tue, 20 Oct 2020 09:05:47 +0200 Subject: [PATCH] [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})