summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2014-12-26 21:19:14 -0700
committerClinton Stimpson <clinton@elemtech.com>2015-01-08 20:56:51 -0700
commit9a8ab86645b0ea1fcbd1b069694d0cbb4fa2621a (patch)
treed6cfe01924dd4c3ca3f57acd5d3fa59b60cde4fa
parent7ecbade8877522d9d565bcb2216f71426873f564 (diff)
downloadcmake-9a8ab86645b0ea1fcbd1b069694d0cbb4fa2621a.tar.gz
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.
-rw-r--r--Tests/Complex/Executable/CMakeLists.txt14
-rw-r--r--Tests/Complex/Executable/complex.cxx22
-rw-r--r--Tests/ComplexOneConfig/Executable/CMakeLists.txt14
-rw-r--r--Tests/ComplexOneConfig/Executable/complex.cxx22
-rw-r--r--Tests/CustomCommand/CMakeLists.txt7
-rw-r--r--Tests/CustomCommand/config.h.in1
-rw-r--r--Tests/CustomCommand/foo.in3
-rw-r--r--Tests/OutDir/OutDir.cmake10
-rw-r--r--Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake2
9 files changed, 49 insertions, 46 deletions
diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt
index bf23d4aa28..508221c89c 100644
--- a/Tests/Complex/Executable/CMakeLists.txt
+++ b/Tests/Complex/Executable/CMakeLists.txt
@@ -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
diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx
index 31442bafa6..ec222a5ace 100644
--- a/Tests/Complex/Executable/complex.cxx
+++ b/Tests/Complex/Executable/complex.cxx
@@ -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
diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt
index 01f1005de2..e910f20e5d 100644
--- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt
@@ -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_BUILD
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
diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx
index 31442bafa6..ec222a5ace 100644
--- a/Tests/ComplexOneConfig/Executable/complex.cxx
+++ b/Tests/ComplexOneConfig/Executable/complex.cxx
@@ -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
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index 915da0a7e6..57ffeec909 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -164,13 +164,6 @@ add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/not_included.h
${PROJECT_BINARY_DIR}/not_included.h
)
-# Tell the executable where to find not_included.h.
-configure_file(
- ${PROJECT_SOURCE_DIR}/config.h.in
- ${PROJECT_BINARY_DIR}/config.h
- @ONLY
- )
-
# add the executable
add_executable(CustomCommand
${PROJECT_BINARY_DIR}/foo.h
diff --git a/Tests/CustomCommand/config.h.in b/Tests/CustomCommand/config.h.in
deleted file mode 100644
index 86c97bd959..0000000000
--- a/Tests/CustomCommand/config.h.in
+++ /dev/null
@@ -1 +0,0 @@
-#define PROJECT_BINARY_DIR "@PROJECT_BINARY_DIR@"
diff --git a/Tests/CustomCommand/foo.in b/Tests/CustomCommand/foo.in
index 0c5021caac..e43aed14c3 100644
--- a/Tests/CustomCommand/foo.in
+++ b/Tests/CustomCommand/foo.in
@@ -1,6 +1,5 @@
#include "doc1.h"
#include "foo.h"
-#include "config.h"
#include <stdio.h>
@@ -11,7 +10,7 @@ int main ()
{
if (generated()*wrapped()*doc() == 3*5*7)
{
- FILE* fin = fopen(PROJECT_BINARY_DIR "/not_included.h", "r");
+ FILE* fin = fopen("not_included.h", "r");
if(fin)
{
fclose(fin);
diff --git a/Tests/OutDir/OutDir.cmake b/Tests/OutDir/OutDir.cmake
index e1e6b7f931..a1f13e7cbd 100644
--- a/Tests/OutDir/OutDir.cmake
+++ b/Tests/OutDir/OutDir.cmake
@@ -16,13 +16,17 @@ find_program(CONLY_EXE
PATHS ${top}/runtime
NO_DEFAULT_PATH)
+file(RELATIVE_PATH TESTC1_LIB_FILE "${top}" "${TESTC1_LIB}")
+file(RELATIVE_PATH TESTC2_LIB_FILE "${top}" "${TESTC2_LIB}")
+file(RELATIVE_PATH CONLY_EXE_FILE "${top}" "${CONLY_EXE}")
+
file(WRITE ${top}/OutDir.h "/* Generated by ${CMAKE_CURRENT_LIST_FILE} */
#ifndef OutDir_h
#define OutDir_h
-#define TESTC1_LIB \"${TESTC1_LIB}\"
-#define TESTC2_LIB \"${TESTC2_LIB}\"
-#define CONLY_EXE \"${CONLY_EXE}\"
+#define TESTC1_LIB \"${TESTC1_LIB_FILE}\"
+#define TESTC2_LIB \"${TESTC2_LIB_FILE}\"
+#define CONLY_EXE \"${CONLY_EXE_FILE}\"
#endif
")
diff --git a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake
index 748d14f85a..2a588bcb70 100644
--- a/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake
+++ b/Tests/RunCMake/GeneratorExpression/ValidTarget-TARGET_PDB_FILE-check.cmake
@@ -1,4 +1,4 @@
-file(STRINGS ${RunCMake_TEST_BINARY_DIR}/test.txt TEST_TXT)
+file(STRINGS ${RunCMake_TEST_BINARY_DIR}/test.txt TEST_TXT ENCODING UTF-8)
list(GET TEST_TXT 0 PDB_PATH)
list(GET TEST_TXT 1 PDB_NAME)