summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorDaniele E. Domenichelli <ddomenichelli@drdanz.it>2017-01-25 09:34:45 +0100
committerDaniele E. Domenichelli <ddomenichelli@drdanz.it>2017-01-26 12:28:12 +0100
commit3cfde818354a8f8e26a9b0b6589f3cc38b50e48d (patch)
tree0ed96321ae86471390ee0a41d2cc416da3d92c0c /Tests
parentf0165eb624403c26989d1039c076d61536cc3074 (diff)
downloadcmake-3cfde818354a8f8e26a9b0b6589f3cc38b50e48d.tar.gz
FeatureSummary: Refactor to use global properties for package types
These new global properties were added: * FeatureSummary_PKG_TYPES: Package types accepted by FeatureSummary (default REQUIRED RECOMMENDED OPTIONAL RUNTIME). * FeatureSummary_REQUIRED_PKG_TYPES: Package types that will cause FeatureSummary to abort when called with FATAL_ON_MISSING_REQUIRED_PACKAGES and a package in these categories is missing (default REQUIRED). * FeatureSummary_DEFAULT_PKG_TYPE: Default package type assigned when not explicitly assigned by the user (default OPTIONAL). This allows to add and remove new package types that can be printed selectively using the "WHAT" argument.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-result.txt1
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-stderr.txt9
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault.cmake8
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-result.txt1
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stderr.txt6
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stdout.txt17
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired.cmake16
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-result.txt1
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stderr.txt6
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stdout.txt17
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA.cmake16
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-result.txt1
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stderr.txt6
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stdout.txt17
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB.cmake16
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes-stdout.txt29
-rw-r--r--Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes.cmake36
-rw-r--r--Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake5
18 files changed, 208 insertions, 0 deletions
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-stderr.txt
new file mode 100644
index 0000000000..58f6125149
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault-stderr.txt
@@ -0,0 +1,9 @@
+CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\):
+ Bad package property type OPTIONAL used in global property
+ FeatureSummary_DEFAULT_PKG_TYPE. Valid types are TYPE1, TYPE2 and TYPE3.
+ Either update FeatureSummary_DEFAULT_PKG_TYPE or add OPTIONAL to the
+ FeatureSummary_PKG_TYPES global property.
+Call Stack \(most recent call first\):
+ .*/Modules/FeatureSummary\.cmake:[0-9]+. \(_FS_GET_FEATURE_SUMMARY\)
+ FeatureSummaryCustomBadDefault.cmake:[0-9]+ \(feature_summary\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault.cmake
new file mode 100644
index 0000000000..7e2fd5533d
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomBadDefault.cmake
@@ -0,0 +1,8 @@
+include(FeatureSummary)
+set_property(GLOBAL PROPERTY FeatureSummary_PKG_TYPES TYPE1 TYPE2 TYPE3)
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
+
+find_package(Foo)
+
+feature_summary(WHAT ALL)
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stderr.txt
new file mode 100644
index 0000000000..e37b9f5516
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\):
+ feature_summary\(\) Error: REQUIRED package\(s\) are missing, aborting CMake
+ run.
+Call Stack \(most recent call first\):
+ FeatureSummaryCustomRequired.cmake:[0-9]+ \(feature_summary\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stdout.txt
new file mode 100644
index 0000000000..ecca71f6ab
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired-stdout.txt
@@ -0,0 +1,17 @@
+-- The following TYPE3 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE2 packages have not been found:
+
+ \* Bar
+
+-- The following TYPE3 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE3 packages have not been found:
+
+ \* Bar
+
+-- Configuring incomplete, errors occurred!
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired.cmake
new file mode 100644
index 0000000000..11cf04c86b
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequired.cmake
@@ -0,0 +1,16 @@
+include(FeatureSummary)
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
+
+set_property(GLOBAL PROPERTY FeatureSummary_PKG_TYPES TYPE1 TYPE2 TYPE3)
+set_property(GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES TYPE3)
+set_property(GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE TYPE2)
+
+find_package(Foo)
+find_package(Bar)
+
+set_package_properties(Foo PROPERTIES TYPE TYPE3)
+feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
+
+set_package_properties(Bar PROPERTIES TYPE TYPE3)
+feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stderr.txt
new file mode 100644
index 0000000000..c9d8b4bb73
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\):
+ feature_summary\(\) Error: REQUIRED package\(s\) are missing, aborting CMake
+ run.
+Call Stack \(most recent call first\):
+ FeatureSummaryCustomRequiredListA.cmake:[0-9]+ \(feature_summary\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stdout.txt
new file mode 100644
index 0000000000..b12d53a590
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA-stdout.txt
@@ -0,0 +1,17 @@
+-- The following TYPE2 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE1 packages have not been found:
+
+ \* Bar
+
+-- The following TYPE2 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE2 packages have not been found:
+
+ \* Bar
+
+-- Configuring incomplete, errors occurred!
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA.cmake
new file mode 100644
index 0000000000..53111bed69
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListA.cmake
@@ -0,0 +1,16 @@
+include(FeatureSummary)
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
+
+set_property(GLOBAL PROPERTY FeatureSummary_PKG_TYPES TYPE1 TYPE2 TYPE3)
+set_property(GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES TYPE2 TYPE3)
+set_property(GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE TYPE1)
+
+find_package(Foo)
+find_package(Bar)
+
+set_package_properties(Foo PROPERTIES TYPE TYPE2)
+feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
+
+set_package_properties(Bar PROPERTIES TYPE TYPE2)
+feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-result.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-result.txt
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stderr.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stderr.txt
new file mode 100644
index 0000000000..8ef7a8db79
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error at .*/Modules/FeatureSummary\.cmake:[0-9]+. \(message\):
+ feature_summary\(\) Error: REQUIRED package\(s\) are missing, aborting CMake
+ run.
+Call Stack \(most recent call first\):
+ FeatureSummaryCustomRequiredListB.cmake:[0-9]+ \(feature_summary\)
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stdout.txt
new file mode 100644
index 0000000000..5f071730a5
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB-stdout.txt
@@ -0,0 +1,17 @@
+-- The following TYPE3 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE1 packages have not been found:
+
+ \* Bar
+
+-- The following TYPE3 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE3 packages have not been found:
+
+ \* Bar
+
+-- Configuring incomplete, errors occurred!
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB.cmake
new file mode 100644
index 0000000000..526b979aaf
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomRequiredListB.cmake
@@ -0,0 +1,16 @@
+include(FeatureSummary)
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
+
+set_property(GLOBAL PROPERTY FeatureSummary_PKG_TYPES TYPE1 TYPE2 TYPE3)
+set_property(GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES TYPE2 TYPE3)
+set_property(GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE TYPE1)
+
+find_package(Foo)
+find_package(Bar)
+
+set_package_properties(Foo PROPERTIES TYPE TYPE3)
+feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
+
+set_package_properties(Bar PROPERTIES TYPE TYPE3)
+feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes-stdout.txt b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes-stdout.txt
new file mode 100644
index 0000000000..a7f973bcf9
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes-stdout.txt
@@ -0,0 +1,29 @@
+-- The following TYPE2 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE1 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE2 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE2 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE3 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE3 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- The following TYPE3 packages have been found:
+
+ \* Foo, The Foo package, <https://foo.example/>
+
+-- Configuring done
diff --git a/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes.cmake b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes.cmake
new file mode 100644
index 0000000000..34b0c1fd0d
--- /dev/null
+++ b/Tests/RunCMake/FeatureSummary/FeatureSummaryCustomTypes.cmake
@@ -0,0 +1,36 @@
+include(FeatureSummary)
+
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
+
+set_property(GLOBAL PROPERTY FeatureSummary_PKG_TYPES TYPE1 TYPE2 TYPE3)
+set_property(GLOBAL PROPERTY FeatureSummary_REQUIRED_PKG_TYPES TYPE3)
+set_property(GLOBAL PROPERTY FeatureSummary_DEFAULT_PKG_TYPE TYPE2)
+
+find_package(Foo)
+
+# Type not set => TYPE2
+feature_summary(WHAT ALL)
+
+# TYPE1 > not set => TYPE1
+set_package_properties(Foo PROPERTIES TYPE TYPE1)
+feature_summary(WHAT ALL)
+
+# TYPE2 > TYPE1 => TYPE2
+set_package_properties(Foo PROPERTIES TYPE TYPE2)
+feature_summary(WHAT ALL)
+
+# TYPE1 < TYPE2 => TYPE2
+set_package_properties(Foo PROPERTIES TYPE TYPE2)
+feature_summary(WHAT ALL)
+
+# TYPE3 > TYPE2 => TYPE3
+set_package_properties(Foo PROPERTIES TYPE TYPE3)
+feature_summary(WHAT ALL)
+
+# TYPE2 < TYPE3 => TYPE3
+set_package_properties(Foo PROPERTIES TYPE TYPE2)
+feature_summary(WHAT ALL)
+
+# TYPE1 < TYPE3 => TYPE3
+set_package_properties(Foo PROPERTIES TYPE TYPE1)
+feature_summary(WHAT ALL)
diff --git a/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake b/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake
index 97c23f9ae4..9caee4c0e6 100644
--- a/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FeatureSummary/RunCMakeTest.cmake
@@ -14,3 +14,8 @@ run_cmake(FeatureSummaryFatalOnMissingRequiredPackages)
run_cmake(FeatureSummaryIncludeQuietPackages)
run_cmake(FeatureSummaryQuietOnEmpty)
run_cmake(FeatureSummaryMultipleDepends)
+run_cmake(FeatureSummaryCustomTypes)
+run_cmake(FeatureSummaryCustomBadDefault)
+run_cmake(FeatureSummaryCustomRequired)
+run_cmake(FeatureSummaryCustomRequiredListA)
+run_cmake(FeatureSummaryCustomRequiredListB)