I want to copy files/folders containing special characters for further use in unit tests and want the files to be overwritten on change.
The OS is Windows
, The OS Standard Language is English
, CMake Version is 3.18.0
, The Generator is Ninja
This is the relevant content of the CMakeLists.txt
...
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/data/"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/data/abcüßöϴABC.txt" "${CMAKE_CURRENT_BINARY_DIR}/data/abcüßöϴABC.txt"
...
This is the output of cmake when running in CMD:
...
Error copying file (if different) from "D:/source_folder/data/abcÔö£ÔòØÔö£ãÆÔö£├é┬ñÔöñABC.txt" to "D:/binary_folder/data/abcÔö£ÔòØÔö£ãÆÔö£├é┬ñÔöñABC.txt".
Batch file failed at line 28 with errorcode 1
According to Notepad++ the CMakeLists.txt
is UTF-8 encoded and has Windows Line Endings (CR LF).
Using ${CMAKE_COMMAND} -E copy_directory
I did not see any change in the target file, when the source file was updated.
I found an Issue regarding this topic, but I am not sure whether I can circumvent the problem using different cmake-commands.