From 0019bfebc949a052d6ef2ac3d0764af307419baa Mon Sep 17 00:00:00 2001
From: Yves Frederix <yves.frederix@dentsplysirona.com>
Date: Tue, 5 Sep 2017 21:15:35 +0200
Subject: FPHSA: Add (failing) unit test in case a cache variable VERSION is
 present

---
 Tests/RunCMake/FPHSA/FindPseudoNoVersionVar.cmake                  | 6 ++++++
 Tests/RunCMake/FPHSA/RunCMakeTest.cmake                            | 7 ++++++-
 Tests/RunCMake/FPHSA/any_version_VERSION_cache_variable-stdout.txt | 2 ++
 Tests/RunCMake/FPHSA/any_version_VERSION_cache_variable.cmake      | 1 +
 4 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100644 Tests/RunCMake/FPHSA/FindPseudoNoVersionVar.cmake
 create mode 100644 Tests/RunCMake/FPHSA/any_version_VERSION_cache_variable-stdout.txt
 create mode 100644 Tests/RunCMake/FPHSA/any_version_VERSION_cache_variable.cmake

diff --git a/Tests/RunCMake/FPHSA/FindPseudoNoVersionVar.cmake b/Tests/RunCMake/FPHSA/FindPseudoNoVersionVar.cmake
new file mode 100644
index 0000000..d961c64
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/FindPseudoNoVersionVar.cmake
@@ -0,0 +1,6 @@
+# pseudo find_module without specifying VERSION_VAR
+
+set(FOOBAR TRUE)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(PseudoNoVersionVar REQUIRED_VARS FOOBAR)
diff --git a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake
index e2fc733..1b71a31 100644
--- a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake
@@ -9,7 +9,12 @@ run_cmake(BadFoundVar)
 set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=0")
 run_cmake(any_version_find_0)
 
-# Find a package with a more customary version number.
+# Find a package with more customary version number, without requestion a specific version and in
+# the presence of a cache variable VERSION.
+set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudoNoVersionVar_VERSION=1.2.3.4.5_SHOULD_BE_IGNORED" "-DVERSION=BAD_VERSION")
+run_cmake(any_version_VERSION_cache_variable)
+
+# Find a package with a more customary version number, without requestion a specific version.
 set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=1.2.3.4.5")
 run_cmake(any_version)
 
diff --git a/Tests/RunCMake/FPHSA/any_version_VERSION_cache_variable-stdout.txt b/Tests/RunCMake/FPHSA/any_version_VERSION_cache_variable-stdout.txt
new file mode 100644
index 0000000..f9acece
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/any_version_VERSION_cache_variable-stdout.txt
@@ -0,0 +1,2 @@
+Found PseudoNoVersionVar: TRUE *
++
diff --git a/Tests/RunCMake/FPHSA/any_version_VERSION_cache_variable.cmake b/Tests/RunCMake/FPHSA/any_version_VERSION_cache_variable.cmake
new file mode 100644
index 0000000..9f27897
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/any_version_VERSION_cache_variable.cmake
@@ -0,0 +1 @@
+find_package(PseudoNoVersionVar REQUIRED)
-- 
cgit v0.12