mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-23 14:48:19 -05:00
Encoding: Modify tests to work using non-ascii paths.
For complex*, CustomCommand and OutDir tests, non-ascii paths are avoided in test code by using relative paths, and setting the working when running the test. This also avoids the need to internationalize the test code. For RunCMake.GeneratorExpression, use a UTF-8 encoding in file(STRINGS) to retrieve the compiled absolute path correctly.
This commit is contained in:
@@ -89,18 +89,22 @@ remove_definitions(-DCOMPLEX_DEFINED)
|
||||
# Test pre-build/pre-link/post-build rules for an executable.
|
||||
add_custom_command(TARGET complex PRE_BUILD
|
||||
COMMAND ${CREATE_FILE_EXE}
|
||||
ARGS "${Complex_BINARY_DIR}/Executable/prebuild.txt")
|
||||
ARGS "Executable/prebuild.txt"
|
||||
WORKING_DIRECTORY "${Complex_BINARY_DIR}")
|
||||
add_custom_command(TARGET complex PRE_LINK
|
||||
COMMAND ${CREATE_FILE_EXE}
|
||||
ARGS "${Complex_BINARY_DIR}/Executable/prelink.txt")
|
||||
ARGS "Executable/prelink.txt"
|
||||
WORKING_DIRECTORY "${Complex_BINARY_DIR}")
|
||||
add_custom_command(TARGET complex POST_BUILD
|
||||
COMMAND ${CREATE_FILE_EXE}
|
||||
ARGS "${Complex_BINARY_DIR}/Executable/postbuild.txt")
|
||||
ARGS "Executable/postbuild.txt"
|
||||
WORKING_DIRECTORY "${Complex_BINARY_DIR}")
|
||||
add_custom_command(TARGET complex POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E copy
|
||||
"${Complex_BINARY_DIR}/Executable/postbuild.txt"
|
||||
"${Complex_BINARY_DIR}/Executable/postbuild2.txt")
|
||||
"Executable/postbuild.txt"
|
||||
"Executable/postbuild2.txt"
|
||||
WORKING_DIRECTORY "${Complex_BINARY_DIR}")
|
||||
|
||||
set_source_files_properties(complex
|
||||
COMPILE_FLAGS
|
||||
|
||||
@@ -716,14 +716,14 @@ int main()
|
||||
// the file was removed the last time 'complex' was run, and it is
|
||||
// only created during a build.
|
||||
|
||||
TestAndRemoveFile(BINARY_DIR "/Library/prebuild.txt");
|
||||
TestAndRemoveFile(BINARY_DIR "/Library/prelink.txt");
|
||||
TestAndRemoveFile(BINARY_DIR "/Library/postbuild.txt");
|
||||
TestAndRemoveFile(BINARY_DIR "/Library/postbuild2.txt");
|
||||
TestAndRemoveFile(BINARY_DIR "/Executable/prebuild.txt");
|
||||
TestAndRemoveFile(BINARY_DIR "/Executable/prelink.txt");
|
||||
TestAndRemoveFile(BINARY_DIR "/Executable/postbuild.txt");
|
||||
TestAndRemoveFile(BINARY_DIR "/Executable/postbuild2.txt");
|
||||
TestAndRemoveFile("Library/prebuild.txt");
|
||||
TestAndRemoveFile("Library/prelink.txt");
|
||||
TestAndRemoveFile("Library/postbuild.txt");
|
||||
TestAndRemoveFile("Library/postbuild2.txt");
|
||||
TestAndRemoveFile("Executable/prebuild.txt");
|
||||
TestAndRemoveFile("Executable/prelink.txt");
|
||||
TestAndRemoveFile("Executable/postbuild.txt");
|
||||
TestAndRemoveFile("Executable/postbuild2.txt");
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// A custom target has been created (see Library/).
|
||||
@@ -733,12 +733,12 @@ int main()
|
||||
// the file was removed the last time 'complex' was run, and it is
|
||||
// only created during a build.
|
||||
|
||||
TestAndRemoveFile(BINARY_DIR "/Library/custom_target1.txt");
|
||||
TestAndRemoveFile("Library/custom_target1.txt");
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// A directory has been created.
|
||||
|
||||
TestDir(BINARY_DIR "/make_dir");
|
||||
TestDir("make_dir");
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Test OUTPUT_REQUIRED_FILES
|
||||
@@ -749,7 +749,7 @@ int main()
|
||||
// the file was removed the last time 'complex' was run, and it is
|
||||
// only created during a build.
|
||||
|
||||
TestAndRemoveFile(BINARY_DIR "/Executable/Temp/complex-required.txt");
|
||||
TestAndRemoveFile("Executable/Temp/complex-required.txt");
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Test FIND_LIBRARY
|
||||
|
||||
Reference in New Issue
Block a user