summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-11-18 15:56:40 (GMT)
committerBrad King <brad.king@kitware.com>2009-11-18 15:56:40 (GMT)
commit5fbefd66dcb28c3b835130ca226d041e53a62f2c (patch)
tree582fe767c16ddcacc9756815e8adf5951ed83b8c /Tests
parent77fddc1f651c1105335e9f9fea436c526257f5e2 (diff)
downloadCMake-5fbefd66dcb28c3b835130ca226d041e53a62f2c.zip
CMake-5fbefd66dcb28c3b835130ca226d041e53a62f2c.tar.gz
CMake-5fbefd66dcb28c3b835130ca226d041e53a62f2c.tar.bz2
Fix get_filename_component(... REALPATH) work dir
The commit "Fix get_filename_component ABSOLUTE mode" broke REALPATH treatment of relative paths because it stopped storing the absolute path in local variable 'filename'. This commit fixes the call to GetRealPath to use the proper local variable and adds a test.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in15
1 files changed, 15 insertions, 0 deletions
diff --git a/Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in b/Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in
index c795512..7adc240 100644
--- a/Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in
+++ b/Tests/CMakeTests/GetFilenameComponentRealpathTest.cmake.in
@@ -13,6 +13,21 @@ if(NOT nonexistent2 STREQUAL "${bindir}/THIS_IS_A_NONEXISTENT_FILE")
endif()
#
+# Test treatment of relative paths
+#
+foreach(c REALPATH ABSOLUTE)
+ get_filename_component(dir "subdir/THIS_IS_A_NONEXISTENT_FILE" ${c})
+ if(NOT "${dir}" STREQUAL "${bindir}/subdir/THIS_IS_A_NONEXISTENT_FILE")
+ message(FATAL_ERROR
+ "${c} does not handle relative paths. Expected:\n"
+ " ${bindir}/subdir/THIS_IS_A_NONEXISTENT_FILE\n"
+ "but got:\n"
+ " ${nonexistent1}\n"
+ )
+ endif()
+endforeach()
+
+#
# Test symbolic link resolution
#
if(UNIX)