summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CMP0139
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2022-06-03 10:42:41 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2022-06-03 17:31:36 (GMT)
commitbe4b9e10afaae750ad184ce1b34d6cb2c3d7fd33 (patch)
tree1c88a4586bb77f93be8e9bf1ddd43cbcad1f4bbe /Tests/RunCMake/CMP0139
parent0aa0b8e146ea8d1dc50b4c045360abd57c3643e4 (diff)
downloadCMake-be4b9e10afaae750ad184ce1b34d6cb2c3d7fd33.zip
CMake-be4b9e10afaae750ad184ce1b34d6cb2c3d7fd33.tar.gz
CMake-be4b9e10afaae750ad184ce1b34d6cb2c3d7fd33.tar.bz2
if command: Add PATH_EQUAL operator
Diffstat (limited to 'Tests/RunCMake/CMP0139')
-rw-r--r--Tests/RunCMake/CMP0139/CMP0139-NEW.cmake25
-rw-r--r--Tests/RunCMake/CMP0139/CMP0139-OLD-result.txt1
-rw-r--r--Tests/RunCMake/CMP0139/CMP0139-OLD-stderr.txt8
-rw-r--r--Tests/RunCMake/CMP0139/CMP0139-OLD.cmake5
-rw-r--r--Tests/RunCMake/CMP0139/CMP0139-WARN-result.txt1
-rw-r--r--Tests/RunCMake/CMP0139/CMP0139-WARN-stderr.txt19
-rw-r--r--Tests/RunCMake/CMP0139/CMP0139-WARN.cmake4
-rw-r--r--Tests/RunCMake/CMP0139/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/CMP0139/RunCMakeTest.cmake5
9 files changed, 71 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMP0139/CMP0139-NEW.cmake b/Tests/RunCMake/CMP0139/CMP0139-NEW.cmake
new file mode 100644
index 0000000..8144696
--- /dev/null
+++ b/Tests/RunCMake/CMP0139/CMP0139-NEW.cmake
@@ -0,0 +1,25 @@
+cmake_policy(SET CMP0139 NEW)
+
+
+set(path "a///b/c")
+if (NOT path PATH_EQUAL "a/b/c")
+ message(SEND_ERROR "if(PATH_EQUAL): '${path}' not equal to 'a/b/c'")
+endif()
+set(path2 "a/b/c")
+if (NOT path PATH_EQUAL path2)
+ message(SEND_ERROR "if(PATH_EQUAL): '${path}' not equal to '${path2}'")
+endif()
+
+set (path "a/b/d/../c")
+if (path PATH_EQUAL "a/b/c")
+ message(SEND_ERROR "if(PATH_EQUAL): '${path}' equal to 'a/b/c'")
+endif()
+set(path2 "a/b/c")
+if ("a/b/d/../c" PATH_EQUAL path2)
+ message(SEND_ERROR "if(PATH_EQUAL): 'a/b/d/../c' equal to '${path2}'")
+endif()
+
+cmake_path(NORMAL_PATH path)
+if (NOT path PATH_EQUAL "a/b/c")
+ message(SEND_ERROR "if(PATH_EQUAL): '${path}' not equal to 'a/b/c'")
+endif()
diff --git a/Tests/RunCMake/CMP0139/CMP0139-OLD-result.txt b/Tests/RunCMake/CMP0139/CMP0139-OLD-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0139/CMP0139-OLD-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0139/CMP0139-OLD-stderr.txt b/Tests/RunCMake/CMP0139/CMP0139-OLD-stderr.txt
new file mode 100644
index 0000000..1cfb319
--- /dev/null
+++ b/Tests/RunCMake/CMP0139/CMP0139-OLD-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at CMP0139-OLD.cmake:[0-9]+ \(if\):
+ if given arguments:
+
+ "/path1" "PATH_EQUAL" "/path2"
+
+ Unknown arguments specified
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CMP0139/CMP0139-OLD.cmake b/Tests/RunCMake/CMP0139/CMP0139-OLD.cmake
new file mode 100644
index 0000000..e813a47
--- /dev/null
+++ b/Tests/RunCMake/CMP0139/CMP0139-OLD.cmake
@@ -0,0 +1,5 @@
+cmake_policy(SET CMP0139 OLD)
+
+if("/path1" PATH_EQUAL "/path2")
+ message("PATH_EQUAL recognized")
+endif()
diff --git a/Tests/RunCMake/CMP0139/CMP0139-WARN-result.txt b/Tests/RunCMake/CMP0139/CMP0139-WARN-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0139/CMP0139-WARN-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0139/CMP0139-WARN-stderr.txt b/Tests/RunCMake/CMP0139/CMP0139-WARN-stderr.txt
new file mode 100644
index 0000000..6a873ca
--- /dev/null
+++ b/Tests/RunCMake/CMP0139/CMP0139-WARN-stderr.txt
@@ -0,0 +1,19 @@
+CMake Warning \(dev\) at CMP0139-WARN.cmake:[0-9]+ \(if\):
+ Policy CMP0139 is not set: The if\(\) command supports path comparisons using
+ PATH_EQUAL operator. Run "cmake --help-policy CMP0139" for policy details.
+ Use the cmake_policy command to set the policy and suppress this warning.
+
+ PATH_EQUAL will be interpreted as an operator when the policy is set to
+ NEW. Since the policy is not set the OLD behavior will be used.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
+
+CMake Error at CMP0139-WARN.cmake:[0-9]+ \(if\):
+ if given arguments:
+
+ "/path1" "PATH_EQUAL" "/path2"
+
+ Unknown arguments specified
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CMP0139/CMP0139-WARN.cmake b/Tests/RunCMake/CMP0139/CMP0139-WARN.cmake
new file mode 100644
index 0000000..d74753e
--- /dev/null
+++ b/Tests/RunCMake/CMP0139/CMP0139-WARN.cmake
@@ -0,0 +1,4 @@
+
+if("/path1" PATH_EQUAL "/path2")
+ message("PATH_EQUAL recognized")
+endif()
diff --git a/Tests/RunCMake/CMP0139/CMakeLists.txt b/Tests/RunCMake/CMP0139/CMakeLists.txt
new file mode 100644
index 0000000..18dfd26
--- /dev/null
+++ b/Tests/RunCMake/CMP0139/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.2)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/CMP0139/RunCMakeTest.cmake b/Tests/RunCMake/CMP0139/RunCMakeTest.cmake
new file mode 100644
index 0000000..2dbea3c
--- /dev/null
+++ b/Tests/RunCMake/CMP0139/RunCMakeTest.cmake
@@ -0,0 +1,5 @@
+include(RunCMake)
+
+run_cmake(CMP0139-OLD)
+run_cmake(CMP0139-WARN)
+run_cmake(CMP0139-NEW)