summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/File_Configure/AtOnly.cmake12
-rw-r--r--Tests/RunCMake/File_Configure/BadArg-stderr.txt4
-rw-r--r--Tests/RunCMake/File_Configure/BadArgContent-result.txt0
-rw-r--r--Tests/RunCMake/File_Configure/BadArgContent-stderr.txt4
-rw-r--r--Tests/RunCMake/File_Configure/BadArgContent.cmake1
-rw-r--r--Tests/RunCMake/File_Configure/BadArgOutput-result.txt (renamed from Tests/RunCMake/File_Configure/BadArg-result.txt)0
-rw-r--r--Tests/RunCMake/File_Configure/BadArgOutput-stderr.txt4
-rw-r--r--Tests/RunCMake/File_Configure/BadArgOutput.cmake (renamed from Tests/RunCMake/File_Configure/BadArg.cmake)0
-rw-r--r--Tests/RunCMake/File_Configure/EscapeQuotes.cmake12
-rw-r--r--Tests/RunCMake/File_Configure/RunCMakeTest.cmake6
-rw-r--r--Tests/RunCMake/File_Configure/UnrecognizedArgs-result.txt1
-rw-r--r--Tests/RunCMake/File_Configure/UnrecognizedArgs-stderr.txt4
-rw-r--r--Tests/RunCMake/File_Configure/UnrecognizedArgs.cmake1
-rw-r--r--Tests/RunCMake/Policy/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/Policy/InvalidMaxVersion-result.txt1
-rw-r--r--Tests/RunCMake/Policy/InvalidMaxVersion-stderr.txt5
-rw-r--r--Tests/RunCMake/Policy/InvalidMaxVersion.cmake5
-rw-r--r--Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven-result.txt0
-rw-r--r--Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven-stderr.txt5
-rw-r--r--Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven.cmake1
-rw-r--r--Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven-result.txt1
-rw-r--r--Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven-stderr.txt5
-rw-r--r--Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven.cmake1
-rw-r--r--Tests/RunCMake/Policy/InvalidVersion-result.txt0
-rw-r--r--Tests/RunCMake/Policy/InvalidVersion-stderr.txt5
-rw-r--r--Tests/RunCMake/Policy/InvalidVersion.cmake5
-rw-r--r--Tests/RunCMake/Policy/MinVersionLargerThanMax-result.txt1
-rw-r--r--Tests/RunCMake/Policy/MinVersionLargerThanMax-stderr.txt4
-rw-r--r--Tests/RunCMake/Policy/MinVersionLargerThanMax.cmake1
-rw-r--r--Tests/RunCMake/Policy/RunCMakeTest.cmake19
-rw-r--r--Tests/RunCMake/Policy/TooManyVersionsGiven-result.txt1
-rw-r--r--Tests/RunCMake/Policy/TooManyVersionsGiven-stderr.txt4
-rw-r--r--Tests/RunCMake/Policy/TooManyVersionsGiven.cmake1
-rw-r--r--Tests/RunCMake/Policy/VersionLowerThan2_4-result.txt1
-rw-r--r--Tests/RunCMake/Policy/VersionLowerThan2_4-stderr.txt6
-rw-r--r--Tests/RunCMake/Policy/VersionLowerThan2_4.cmake1
-rw-r--r--Tests/RunCMake/Policy/VersionNotGiven-result.txt1
-rw-r--r--Tests/RunCMake/Policy/VersionNotGiven-stderr.txt4
-rw-r--r--Tests/RunCMake/Policy/VersionNotGiven.cmake1
-rw-r--r--Tests/RunCMake/Policy/VeryHighVersion-result.txt1
-rw-r--r--Tests/RunCMake/Policy/VeryHighVersion-stderr.txt7
-rw-r--r--Tests/RunCMake/Policy/VeryHighVersion.cmake1
-rw-r--r--Tests/RunCMake/WriteBasicConfigVersionFile/All.cmake125
44 files changed, 243 insertions, 23 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index c0e4bce..540a718 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -288,6 +288,7 @@ add_RunCMake_test(ToolchainFile)
add_RunCMake_test(find_dependency)
add_RunCMake_test(CompileDefinitions)
add_RunCMake_test(CompileFeatures)
+add_RunCMake_test(Policy)
add_RunCMake_test(PolicyScope)
add_RunCMake_test(WriteBasicConfigVersionFile)
add_RunCMake_test(WriteCompilerDetectionHeader)
diff --git a/Tests/RunCMake/File_Configure/AtOnly.cmake b/Tests/RunCMake/File_Configure/AtOnly.cmake
new file mode 100644
index 0000000..cc5304a
--- /dev/null
+++ b/Tests/RunCMake/File_Configure/AtOnly.cmake
@@ -0,0 +1,12 @@
+set(file_name ${CMAKE_CURRENT_BINARY_DIR}/atonly.txt)
+set(var_a "a")
+set(var_b "b")
+file(CONFIGURE
+ OUTPUT ${file_name}
+ CONTENT "-->@var_a@<-- -->${var_b}<--"
+ @ONLY
+)
+file(READ ${file_name} file_content)
+if(NOT file_content STREQUAL "-->a<-- -->${var_b}<--")
+ message(FATAL_ERROR "@ONLY doesn't work")
+endif()
diff --git a/Tests/RunCMake/File_Configure/BadArg-stderr.txt b/Tests/RunCMake/File_Configure/BadArg-stderr.txt
deleted file mode 100644
index 5423a28..0000000
--- a/Tests/RunCMake/File_Configure/BadArg-stderr.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-CMake Error at BadArg.cmake:[0-9]+ \(file\):
- file Incorrect arguments to CONFIGURE subcommand.
-Call Stack \(most recent call first\):
- CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/File_Configure/BadArgContent-result.txt b/Tests/RunCMake/File_Configure/BadArgContent-result.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/File_Configure/BadArgContent-result.txt
diff --git a/Tests/RunCMake/File_Configure/BadArgContent-stderr.txt b/Tests/RunCMake/File_Configure/BadArgContent-stderr.txt
new file mode 100644
index 0000000..a6ea314
--- /dev/null
+++ b/Tests/RunCMake/File_Configure/BadArgContent-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at BadArgContent.cmake:[0-9]+ \(file\):
+ file CONFIGURE CONTENT option needs a value.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/File_Configure/BadArgContent.cmake b/Tests/RunCMake/File_Configure/BadArgContent.cmake
new file mode 100644
index 0000000..282dc18
--- /dev/null
+++ b/Tests/RunCMake/File_Configure/BadArgContent.cmake
@@ -0,0 +1 @@
+file(CONFIGURE CONTENT)
diff --git a/Tests/RunCMake/File_Configure/BadArg-result.txt b/Tests/RunCMake/File_Configure/BadArgOutput-result.txt
index d00491f..d00491f 100644
--- a/Tests/RunCMake/File_Configure/BadArg-result.txt
+++ b/Tests/RunCMake/File_Configure/BadArgOutput-result.txt
diff --git a/Tests/RunCMake/File_Configure/BadArgOutput-stderr.txt b/Tests/RunCMake/File_Configure/BadArgOutput-stderr.txt
new file mode 100644
index 0000000..b5a924c
--- /dev/null
+++ b/Tests/RunCMake/File_Configure/BadArgOutput-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at BadArgOutput.cmake:[0-9]+ \(file\):
+ file CONFIGURE OUTPUT option needs a value.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/File_Configure/BadArg.cmake b/Tests/RunCMake/File_Configure/BadArgOutput.cmake
index 7c7fcda..7c7fcda 100644
--- a/Tests/RunCMake/File_Configure/BadArg.cmake
+++ b/Tests/RunCMake/File_Configure/BadArgOutput.cmake
diff --git a/Tests/RunCMake/File_Configure/EscapeQuotes.cmake b/Tests/RunCMake/File_Configure/EscapeQuotes.cmake
new file mode 100644
index 0000000..1136c87
--- /dev/null
+++ b/Tests/RunCMake/File_Configure/EscapeQuotes.cmake
@@ -0,0 +1,12 @@
+set(file_name ${CMAKE_CURRENT_BINARY_DIR}/escape_quotes.txt)
+set(var "\t")
+set(ref "${var}")
+file(CONFIGURE
+ CONTENT "-->@ref@<--"
+ OUTPUT ${file_name}
+ ESCAPE_QUOTES
+)
+file(READ ${file_name} file_content)
+if(NOT file_content MATCHES "^-->\t<--$")
+ message(FATAL_ERROR "ESCAPE_QUOTES doesn't work")
+endif()
diff --git a/Tests/RunCMake/File_Configure/RunCMakeTest.cmake b/Tests/RunCMake/File_Configure/RunCMakeTest.cmake
index e79de79..5022985 100644
--- a/Tests/RunCMake/File_Configure/RunCMakeTest.cmake
+++ b/Tests/RunCMake/File_Configure/RunCMakeTest.cmake
@@ -1,10 +1,14 @@
include(RunCMake)
run_cmake(AngleBracketsContent)
-run_cmake(BadArg)
+run_cmake(BadArgOutput)
+run_cmake(BadArgContent)
run_cmake(BadArgGeneratorExpressionOutput)
+run_cmake(UnrecognizedArgs)
run_cmake(DirOutput)
run_cmake(NewLineStyle-NoArg)
run_cmake(NewLineStyle-ValidArg)
run_cmake(NewLineStyle-WrongArg)
run_cmake(SubDir)
+run_cmake(AtOnly)
+run_cmake(EscapeQuotes)
diff --git a/Tests/RunCMake/File_Configure/UnrecognizedArgs-result.txt b/Tests/RunCMake/File_Configure/UnrecognizedArgs-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/File_Configure/UnrecognizedArgs-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/File_Configure/UnrecognizedArgs-stderr.txt b/Tests/RunCMake/File_Configure/UnrecognizedArgs-stderr.txt
new file mode 100644
index 0000000..1dd1a20
--- /dev/null
+++ b/Tests/RunCMake/File_Configure/UnrecognizedArgs-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at UnrecognizedArgs.cmake:[0-9]+ \(file\):
+ file CONFIGURE Unrecognized argument: "INPUT"
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/File_Configure/UnrecognizedArgs.cmake b/Tests/RunCMake/File_Configure/UnrecognizedArgs.cmake
new file mode 100644
index 0000000..93ea7b5
--- /dev/null
+++ b/Tests/RunCMake/File_Configure/UnrecognizedArgs.cmake
@@ -0,0 +1 @@
+file(CONFIGURE INPUT)
diff --git a/Tests/RunCMake/Policy/CMakeLists.txt b/Tests/RunCMake/Policy/CMakeLists.txt
new file mode 100644
index 0000000..667561e
--- /dev/null
+++ b/Tests/RunCMake/Policy/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.12)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
diff --git a/Tests/RunCMake/Policy/InvalidMaxVersion-result.txt b/Tests/RunCMake/Policy/InvalidMaxVersion-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Policy/InvalidMaxVersion-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Policy/InvalidMaxVersion-stderr.txt b/Tests/RunCMake/Policy/InvalidMaxVersion-stderr.txt
new file mode 100644
index 0000000..25d22f5
--- /dev/null
+++ b/Tests/RunCMake/Policy/InvalidMaxVersion-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at InvalidMaxVersion.cmake:[0-9]+ \(cmake_policy\):
+ Invalid policy max version value "[A-Za-z0-9]+.[A-Za-z0-9]*.[A-Za-z0-9]*.[A-Za-z0-9]*"\. A numeric
+ major.minor\[\.patch\[\.tweak\]\] must be given\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/Policy/InvalidMaxVersion.cmake b/Tests/RunCMake/Policy/InvalidMaxVersion.cmake
new file mode 100644
index 0000000..be3270f
--- /dev/null
+++ b/Tests/RunCMake/Policy/InvalidMaxVersion.cmake
@@ -0,0 +1,5 @@
+if(NOT version)
+ message(SEND_ERROR "Vesrion string is empty: ${version}")
+endif()
+
+cmake_policy(VERSION 3.1...${version})
diff --git a/Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven-result.txt b/Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven-result.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven-result.txt
diff --git a/Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven-stderr.txt b/Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven-stderr.txt
new file mode 100644
index 0000000..a48feb3
--- /dev/null
+++ b/Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at InvalidRangeMaxVersionNotGiven.cmake:[0-9]+ \(cmake_policy\):
+ cmake_policy VERSION "3.15..." does not have a version on both sides of
+ "...".
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven.cmake b/Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven.cmake
new file mode 100644
index 0000000..e55803c
--- /dev/null
+++ b/Tests/RunCMake/Policy/InvalidRangeMaxVersionNotGiven.cmake
@@ -0,0 +1 @@
+cmake_policy(VERSION 3.15...)
diff --git a/Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven-result.txt b/Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven-stderr.txt b/Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven-stderr.txt
new file mode 100644
index 0000000..84e9b88
--- /dev/null
+++ b/Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at InvalidRangeMinVersionNotGiven.cmake:[0-9]+ \(cmake_policy\):
+ cmake_policy VERSION "...3.15" does not have a version on both sides of
+ "...".
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven.cmake b/Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven.cmake
new file mode 100644
index 0000000..60e7e25
--- /dev/null
+++ b/Tests/RunCMake/Policy/InvalidRangeMinVersionNotGiven.cmake
@@ -0,0 +1 @@
+cmake_policy(VERSION ...3.15)
diff --git a/Tests/RunCMake/Policy/InvalidVersion-result.txt b/Tests/RunCMake/Policy/InvalidVersion-result.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/Policy/InvalidVersion-result.txt
diff --git a/Tests/RunCMake/Policy/InvalidVersion-stderr.txt b/Tests/RunCMake/Policy/InvalidVersion-stderr.txt
new file mode 100644
index 0000000..783f4ed
--- /dev/null
+++ b/Tests/RunCMake/Policy/InvalidVersion-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at InvalidVersion.cmake:[0-9]+ \(cmake_policy\):
+ Invalid policy version value "[A-Za-z0-9]+.[A-Za-z0-9]*.[A-Za-z0-9]*.[A-Za-z0-9]*"\. A numeric
+ major\.minor\[\.patch\[\.tweak\]\] must be given\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/Policy/InvalidVersion.cmake b/Tests/RunCMake/Policy/InvalidVersion.cmake
new file mode 100644
index 0000000..b135ba6
--- /dev/null
+++ b/Tests/RunCMake/Policy/InvalidVersion.cmake
@@ -0,0 +1,5 @@
+if(NOT version)
+ message(SEND_ERROR "Vesrion string is empty: ${version}")
+endif()
+
+cmake_policy(VERSION ${version})
diff --git a/Tests/RunCMake/Policy/MinVersionLargerThanMax-result.txt b/Tests/RunCMake/Policy/MinVersionLargerThanMax-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Policy/MinVersionLargerThanMax-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Policy/MinVersionLargerThanMax-stderr.txt b/Tests/RunCMake/Policy/MinVersionLargerThanMax-stderr.txt
new file mode 100644
index 0000000..0b0308f
--- /dev/null
+++ b/Tests/RunCMake/Policy/MinVersionLargerThanMax-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at MinVersionLargerThanMax.cmake:[0-9]+ \(cmake_policy\):
+ Policy VERSION range "3.12...3.8" specifies a larger minimum than maximum.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/Policy/MinVersionLargerThanMax.cmake b/Tests/RunCMake/Policy/MinVersionLargerThanMax.cmake
new file mode 100644
index 0000000..67d5f85
--- /dev/null
+++ b/Tests/RunCMake/Policy/MinVersionLargerThanMax.cmake
@@ -0,0 +1 @@
+cmake_policy(VERSION 3.12...3.8)
diff --git a/Tests/RunCMake/Policy/RunCMakeTest.cmake b/Tests/RunCMake/Policy/RunCMakeTest.cmake
new file mode 100644
index 0000000..74c7d63
--- /dev/null
+++ b/Tests/RunCMake/Policy/RunCMakeTest.cmake
@@ -0,0 +1,19 @@
+include(RunCMake)
+
+run_cmake(VersionNotGiven)
+run_cmake(TooManyVersionsGiven)
+run_cmake(InvalidRangeMinVersionNotGiven)
+run_cmake(InvalidRangeMaxVersionNotGiven)
+
+set(RunCMake_TEST_OPTIONS "-Dversion=three")
+run_cmake(InvalidVersion)
+run_cmake(InvalidMaxVersion)
+unset(RunCMake_TEST_OPTIONS)
+set(RunCMake_TEST_OPTIONS "-Dversion=3.one")
+run_cmake(InvalidVersion)
+run_cmake(InvalidMaxVersion)
+unset(RunCMake_TEST_OPTIONS)
+
+run_cmake(VersionLowerThan2_4)
+run_cmake(MinVersionLargerThanMax)
+run_cmake(VeryHighVersion)
diff --git a/Tests/RunCMake/Policy/TooManyVersionsGiven-result.txt b/Tests/RunCMake/Policy/TooManyVersionsGiven-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Policy/TooManyVersionsGiven-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Policy/TooManyVersionsGiven-stderr.txt b/Tests/RunCMake/Policy/TooManyVersionsGiven-stderr.txt
new file mode 100644
index 0000000..7a4f8c7
--- /dev/null
+++ b/Tests/RunCMake/Policy/TooManyVersionsGiven-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at TooManyVersionsGiven.cmake:[0-9]+ \(cmake_policy\):
+ cmake_policy VERSION given too many arguments
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/Policy/TooManyVersionsGiven.cmake b/Tests/RunCMake/Policy/TooManyVersionsGiven.cmake
new file mode 100644
index 0000000..6c99af2
--- /dev/null
+++ b/Tests/RunCMake/Policy/TooManyVersionsGiven.cmake
@@ -0,0 +1 @@
+cmake_policy(VERSION 1 2 3)
diff --git a/Tests/RunCMake/Policy/VersionLowerThan2_4-result.txt b/Tests/RunCMake/Policy/VersionLowerThan2_4-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Policy/VersionLowerThan2_4-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Policy/VersionLowerThan2_4-stderr.txt b/Tests/RunCMake/Policy/VersionLowerThan2_4-stderr.txt
new file mode 100644
index 0000000..3f19192
--- /dev/null
+++ b/Tests/RunCMake/Policy/VersionLowerThan2_4-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at VersionLowerThan2_4.cmake:[0-9]+ \(cmake_policy\):
+ Compatibility with CMake < 2.4 is not supported by CMake >= 3.0. For
+ compatibility with older versions please use any CMake 2.8.x release or
+ lower.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/Policy/VersionLowerThan2_4.cmake b/Tests/RunCMake/Policy/VersionLowerThan2_4.cmake
new file mode 100644
index 0000000..f1a4fd9
--- /dev/null
+++ b/Tests/RunCMake/Policy/VersionLowerThan2_4.cmake
@@ -0,0 +1 @@
+cmake_policy(VERSION 2.2)
diff --git a/Tests/RunCMake/Policy/VersionNotGiven-result.txt b/Tests/RunCMake/Policy/VersionNotGiven-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Policy/VersionNotGiven-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Policy/VersionNotGiven-stderr.txt b/Tests/RunCMake/Policy/VersionNotGiven-stderr.txt
new file mode 100644
index 0000000..8eeb177
--- /dev/null
+++ b/Tests/RunCMake/Policy/VersionNotGiven-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at VersionNotGiven.cmake:[0-9]+ \(cmake_policy\):
+ cmake_policy VERSION not given an argument
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/Policy/VersionNotGiven.cmake b/Tests/RunCMake/Policy/VersionNotGiven.cmake
new file mode 100644
index 0000000..53b3d7f
--- /dev/null
+++ b/Tests/RunCMake/Policy/VersionNotGiven.cmake
@@ -0,0 +1 @@
+cmake_policy(VERSION)
diff --git a/Tests/RunCMake/Policy/VeryHighVersion-result.txt b/Tests/RunCMake/Policy/VeryHighVersion-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/Policy/VeryHighVersion-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/Policy/VeryHighVersion-stderr.txt b/Tests/RunCMake/Policy/VeryHighVersion-stderr.txt
new file mode 100644
index 0000000..7cca91b
--- /dev/null
+++ b/Tests/RunCMake/Policy/VeryHighVersion-stderr.txt
@@ -0,0 +1,7 @@
+CMake Error at VeryHighVersion.cmake:[0-9]+ \(cmake_policy\):
+ An attempt was made to set the policy version of CMake to "99.1" which is
+ greater than this version of CMake. This is not allowed because the
+ greater version may have new policies not known to this CMake. You may
+ need a newer CMake version to build this project.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/Policy/VeryHighVersion.cmake b/Tests/RunCMake/Policy/VeryHighVersion.cmake
new file mode 100644
index 0000000..3d4af8c
--- /dev/null
+++ b/Tests/RunCMake/Policy/VeryHighVersion.cmake
@@ -0,0 +1 @@
+cmake_policy(VERSION 99.1)
diff --git a/Tests/RunCMake/WriteBasicConfigVersionFile/All.cmake b/Tests/RunCMake/WriteBasicConfigVersionFile/All.cmake
index 4253652..c32c92d 100644
--- a/Tests/RunCMake/WriteBasicConfigVersionFile/All.cmake
+++ b/Tests/RunCMake/WriteBasicConfigVersionFile/All.cmake
@@ -3,16 +3,16 @@ set(CMAKE_SIZEOF_VOID_P 4)
include(WriteBasicConfigVersionFile)
-set(_compatibilities AnyNewerVersion
- SameMajorVersion
- SameMinorVersion
- ExactVersion)
+set(COMPATIBILITIES AnyNewerVersion
+ SameMajorVersion
+ SameMinorVersion
+ ExactVersion)
function(TEST_WRITE_BASIC_CONFIG_VERSION_FILE_PREPARE _version_installed)
set(_same_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
set(_no_CMAKE_SIZEOF_VOID_P "")
math(EXPR _diff_CMAKE_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P} + 1")
- foreach(_compat ${_compatibilities})
+ foreach(_compat ${COMPATIBILITIES})
set(_pkg ${_compat}${_version_installed})
string(REPLACE "." "" _pkg ${_pkg})
set(_filename "${CMAKE_CURRENT_BINARY_DIR}/${_pkg}ConfigVersion.cmake")
@@ -71,20 +71,58 @@ function(TEST_WRITE_BASIC_CONFIG_VERSION_FILE _version_installed
_expected_compatible_SameMajorVersion
_expected_compatible_SameMinorVersion
_expected_compatible_ExactVersion)
- set(PACKAGE_FIND_VERSION ${_version_requested})
- if("${PACKAGE_FIND_VERSION}" MATCHES [[(^([0-9]+)(\.([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?)?)?$]])
- set(PACKAGE_FIND_VERSION_MAJOR "${CMAKE_MATCH_2}")
- set(PACKAGE_FIND_VERSION_MINOR "${CMAKE_MATCH_4}")
- set(PACKAGE_FIND_VERSION_PATCH "${CMAKE_MATCH_6}")
- set(PACKAGE_FIND_VERSION_TWEAK "${CMAKE_MATCH_8}")
- else()
- message(FATAL_ERROR "_version_requested (${_version_requested}) should be a version number")
- endif()
-
- if ("${_version_installed}" STREQUAL "${_version_requested}")
- set(_expected_exact 1)
- else()
+ if("${_version_requested}" MATCHES [[^([0-9]+(\.[0-9]+)*)\.\.\.(<)?([0-9]+(\.[0-9]+)*)$]])
+ set (_compatibilities ${COMPATIBILITIES})
+ # ExactVersion must not be tested
+ list(POP_BACK _compatibilities)
+ set(PACKAGE_FIND_VERSION_RANGE TRUE)
+ set(PACKAGE_FIND_VERSION_RANGE_MIN INCLUDE)
+ if ("${CMAKE_MATCH_3}" STREQUAL "<")
+ set(PACKAGE_FIND_VERSION_RANGE_MAX EXCLUDE)
+ else()
+ set(PACKAGE_FIND_VERSION_RANGE_MAX INCLUDE)
+ endif()
+ set(PACKAGE_FIND_VERSION_MIN "${CMAKE_MATCH_1}")
+ set(PACKAGE_FIND_VERSION_MAX "${CMAKE_MATCH_4}")
+ if("${PACKAGE_FIND_VERSION_MIN}" MATCHES [[(^([0-9]+)(\.([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?)?)?$]])
+ set(PACKAGE_FIND_VERSION_MIN_MAJOR "${CMAKE_MATCH_2}")
+ set(PACKAGE_FIND_VERSION_MIN_MINOR "${CMAKE_MATCH_4}")
+ set(PACKAGE_FIND_VERSION_MIN_PATCH "${CMAKE_MATCH_6}")
+ set(PACKAGE_FIND_VERSION_MIN_TWEAK "${CMAKE_MATCH_8}")
+ else()
+ message(FATAL_ERROR "_version_requested (${_version_requested}) should be a version range")
+ endif()
+ set(PACKAGE_FIND_VERSION "${PACKAGE_FIND_VERSION_MIN}")
+ set(PACKAGE_FIND_VERSION_MAJOR "${PACKAGE_FIND_VERSION_MIN_MAJOR}")
+ set(PACKAGE_FIND_VERSION_MINOR "${PACKAGE_FIND_VERSION_MIN_MINOR}")
+ set(PACKAGE_FIND_VERSION_PATCH "${PACKAGE_FIND_VERSION_MIN_PATCH}")
+ set(PACKAGE_FIND_VERSION_TWEAK "${PACKAGE_FIND_VERSION_MIN_TWEAK}")
+ if("${PACKAGE_FIND_VERSION_MAX}" MATCHES [[(^([0-9]+)(\.([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?)?)?$]])
+ set(PACKAGE_FIND_VERSION_MAX_MAJOR "${CMAKE_MATCH_2}")
+ set(PACKAGE_FIND_VERSION_MAX_MINOR "${CMAKE_MATCH_4}")
+ set(PACKAGE_FIND_VERSION_MAX_PATCH "${CMAKE_MATCH_6}")
+ set(PACKAGE_FIND_VERSION_MAX_TWEAK "${CMAKE_MATCH_8}")
+ else()
+ message(FATAL_ERROR "_version_requested (${_version_requested}) should be a version range")
+ endif()
set(_expected_exact 0)
+ else()
+ set (_compatibilities ${COMPATIBILITIES})
+ set(PACKAGE_FIND_VERSION ${_version_requested})
+ if("${PACKAGE_FIND_VERSION}" MATCHES [[(^([0-9]+)(\.([0-9]+)(\.([0-9]+)(\.([0-9]+))?)?)?)?$]])
+ set(PACKAGE_FIND_VERSION_MAJOR "${CMAKE_MATCH_2}")
+ set(PACKAGE_FIND_VERSION_MINOR "${CMAKE_MATCH_4}")
+ set(PACKAGE_FIND_VERSION_PATCH "${CMAKE_MATCH_6}")
+ set(PACKAGE_FIND_VERSION_TWEAK "${CMAKE_MATCH_8}")
+ else()
+ message(FATAL_ERROR "_version_requested (${_version_requested}) should be a version number")
+ endif()
+
+ if ("${_version_installed}" STREQUAL "${_version_requested}")
+ set(_expected_exact 1)
+ else()
+ set(_expected_exact 0)
+ endif()
endif()
unset(PACKAGE_VERSION_COMPATIBLE)
@@ -882,3 +920,54 @@ test_write_basic_config_version_file(4.5.6.7 9.9.9.0 0 0 0 0) # Request [ne
test_write_basic_config_version_file(4.5.6.7 9.9.9.2 0 0 0 0) # Request [newer major].[newer minor].[newer patch].[older tweak]
test_write_basic_config_version_file(4.5.6.7 9.9.9.7 0 0 0 0) # Request [newer major].[newer minor].[newer patch].[same tweak]
test_write_basic_config_version_file(4.5.6.7 9.9.9.9 0 0 0 0) # Request [newer major].[newer minor].[newer patch].[newer tweak]
+
+test_write_basic_config_version_file(4 0...5 1 0 0 0)
+test_write_basic_config_version_file(4 2...5 1 0 0 0)
+test_write_basic_config_version_file(4 2...4 1 0 0 0)
+test_write_basic_config_version_file(4 4...<5 1 1 0 0)
+test_write_basic_config_version_file(4 9...10 0 0 0 0)
+
+test_write_basic_config_version_file(4 0.1...5 1 0 0 0)
+test_write_basic_config_version_file(4 2.1...5 1 0 0 0)
+test_write_basic_config_version_file(4 2.8...5 1 0 0 0)
+test_write_basic_config_version_file(4 2.1...4 1 0 0 0)
+test_write_basic_config_version_file(4 2.8...4 1 0 0 0)
+test_write_basic_config_version_file(4 4.0...<5 1 1 0 0)
+test_write_basic_config_version_file(4 4.8...<5 0 0 0 0)
+test_write_basic_config_version_file(4 4.1...5 0 0 0 0)
+test_write_basic_config_version_file(4 4.8...5 0 0 0 0)
+test_write_basic_config_version_file(4 9.1...10 0 0 0 0)
+test_write_basic_config_version_file(4 9.8...10 0 0 0 0)
+
+
+test_write_basic_config_version_file(4.5 0.1...5 1 0 0 0)
+test_write_basic_config_version_file(4.5 2.1...5 1 0 0 0)
+test_write_basic_config_version_file(4.5 2.8...5 1 0 0 0)
+test_write_basic_config_version_file(4.5 2.1...4 0 0 0 0)
+test_write_basic_config_version_file(4.5 2.8...4 0 0 0 0)
+test_write_basic_config_version_file(4.5 2.8...4.8 1 0 0 0)
+test_write_basic_config_version_file(4.5 4.1...<5 1 1 0 0)
+test_write_basic_config_version_file(4.5 4.8...<5 0 0 0 0)
+test_write_basic_config_version_file(4.5 4.5...4.5.8 1 1 1 0)
+test_write_basic_config_version_file(4.5 4.5...<4.6 1 1 1 0)
+test_write_basic_config_version_file(4.5 4.1...5 1 0 0 0)
+test_write_basic_config_version_file(4.5 4.8...5 0 0 0 0)
+test_write_basic_config_version_file(4.5 9.1...10 0 0 0 0)
+test_write_basic_config_version_file(4.5 9.8...10 0 0 0 0)
+
+
+test_write_basic_config_version_file(4.5.6 0.1...5 1 0 0 0)
+test_write_basic_config_version_file(4.5.6 2.1...5 1 0 0 0)
+test_write_basic_config_version_file(4.5.6 2.8...5 1 0 0 0)
+test_write_basic_config_version_file(4.5.6 2.1...4 0 0 0 0)
+test_write_basic_config_version_file(4.5.6 2.8...4 0 0 0 0)
+test_write_basic_config_version_file(4.5.6 2.8...4.8 1 0 0 0)
+test_write_basic_config_version_file(4.5.6 4.1...<5 1 1 0 0)
+test_write_basic_config_version_file(4.5.6 4.8...<5 0 0 0 0)
+test_write_basic_config_version_file(4.5.6 4.5...4.5.4 0 0 0 0)
+test_write_basic_config_version_file(4.5.6 4.5...4.5.8 1 1 1 0)
+test_write_basic_config_version_file(4.5.6 4.5...<4.6 1 1 1 0)
+test_write_basic_config_version_file(4.5.6 4.1...5 1 0 0 0)
+test_write_basic_config_version_file(4.5.6 4.8...5 0 0 0 0)
+test_write_basic_config_version_file(4.5.6 9.1...10 0 0 0 0)
+test_write_basic_config_version_file(4.5.6 9.8...10 0 0 0 0)