summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/file
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2020-08-26 12:33:18 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2020-09-08 16:33:57 (GMT)
commitbe36266dabee16d17a4f2e71fa9d05f8ef4769ce (patch)
tree57d4da5efc5b6b4dc8837acb63dcb471fd8266b5 /Tests/RunCMake/file
parent503d0f80e1ccafa8352145b1a733dd41751dcd7f (diff)
downloadCMake-be36266dabee16d17a4f2e71fa9d05f8ef4769ce.zip
CMake-be36266dabee16d17a4f2e71fa9d05f8ef4769ce.tar.gz
CMake-be36266dabee16d17a4f2e71fa9d05f8ef4769ce.tar.bz2
file(): Add REAL_PATH sub-command
Diffstat (limited to 'Tests/RunCMake/file')
-rw-r--r--Tests/RunCMake/file/REAL_PATH-no-base-dir-result.txt1
-rw-r--r--Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt2
-rw-r--r--Tests/RunCMake/file/REAL_PATH-no-base-dir.cmake2
-rw-r--r--Tests/RunCMake/file/REAL_PATH-unexpected-arg-result.txt1
-rw-r--r--Tests/RunCMake/file/REAL_PATH-unexpected-arg-stderr.txt2
-rw-r--r--Tests/RunCMake/file/REAL_PATH-unexpected-arg.cmake2
-rw-r--r--Tests/RunCMake/file/REAL_PATH.cmake14
-rw-r--r--Tests/RunCMake/file/RunCMakeTest.cmake3
8 files changed, 27 insertions, 0 deletions
diff --git a/Tests/RunCMake/file/REAL_PATH-no-base-dir-result.txt b/Tests/RunCMake/file/REAL_PATH-no-base-dir-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH-no-base-dir-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt b/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt
new file mode 100644
index 0000000..7c58aeb
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH-no-base-dir-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at REAL_PATH-no-base-dir.cmake:[0-9]+ \(file\):
+ file BASE_DIRECTORY requires a value
diff --git a/Tests/RunCMake/file/REAL_PATH-no-base-dir.cmake b/Tests/RunCMake/file/REAL_PATH-no-base-dir.cmake
new file mode 100644
index 0000000..132aee6
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH-no-base-dir.cmake
@@ -0,0 +1,2 @@
+
+file(REAL_PATH "some-path" real_path BASE_DIRECTORY)
diff --git a/Tests/RunCMake/file/REAL_PATH-unexpected-arg-result.txt b/Tests/RunCMake/file/REAL_PATH-unexpected-arg-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH-unexpected-arg-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/file/REAL_PATH-unexpected-arg-stderr.txt b/Tests/RunCMake/file/REAL_PATH-unexpected-arg-stderr.txt
new file mode 100644
index 0000000..301db75
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH-unexpected-arg-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error at REAL_PATH-unexpected-arg.cmake:[0-9]+ \(file\):
+ file REAL_PATH called with unexpected arguments
diff --git a/Tests/RunCMake/file/REAL_PATH-unexpected-arg.cmake b/Tests/RunCMake/file/REAL_PATH-unexpected-arg.cmake
new file mode 100644
index 0000000..144f30b
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH-unexpected-arg.cmake
@@ -0,0 +1,2 @@
+
+file(REAL_PATH "some-path" real_path extra_arg)
diff --git a/Tests/RunCMake/file/REAL_PATH.cmake b/Tests/RunCMake/file/REAL_PATH.cmake
new file mode 100644
index 0000000..be25706
--- /dev/null
+++ b/Tests/RunCMake/file/REAL_PATH.cmake
@@ -0,0 +1,14 @@
+
+file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/test.txt")
+file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/test.sym")
+file(CREATE_LINK "test.txt" "${CMAKE_CURRENT_BINARY_DIR}/test.sym" SYMBOLIC)
+
+file(REAL_PATH "${CMAKE_CURRENT_BINARY_DIR}/test.sym" real_path)
+if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/test.txt")
+ message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/test.txt\"")
+endif()
+
+file(REAL_PATH "test.sym" real_path BASE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
+if (NOT real_path STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/test.txt")
+ message(SEND_ERROR "real path is \"${real_path}\", should be \"${CMAKE_CURRENT_BINARY_DIR}/test.txt\"")
+endif()
diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake
index 8d84943..22813eb 100644
--- a/Tests/RunCMake/file/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file/RunCMakeTest.cmake
@@ -72,6 +72,9 @@ if(NOT WIN32 OR CYGWIN)
run_cmake(READ_SYMLINK-noexist)
run_cmake(READ_SYMLINK-notsymlink)
run_cmake(INSTALL-FOLLOW_SYMLINK_CHAIN)
+ run_cmake(REAL_PATH-unexpected-arg)
+ run_cmake(REAL_PATH-no-base-dir)
+ run_cmake(REAL_PATH)
endif()
if(RunCMake_GENERATOR MATCHES "Ninja")