Explorar o código

cmPackageInfoArguments: Validate new arguments

Add validation of recently added `DESCRIPTION` and `HOMEPAGE_URL`
arguments to `export`/`install` commands.
Matthew Woehlke hai 4 meses
pai
achega
bb1e00b92c

+ 4 - 0
Source/cmPackageInfoArguments.cxx

@@ -60,6 +60,8 @@ bool cmPackageInfoArguments::Check(cmExecutionStatus& status,
     ENFORCE_REQUIRES("PACKAGE_INFO", this->LowerCase, "LOWER_CASE_FILE");
     ENFORCE_REQUIRES("PACKAGE_INFO", this->Appendix, "APPENDIX");
     ENFORCE_REQUIRES("PACKAGE_INFO", this->Version, "VERSION");
+    ENFORCE_REQUIRES("PACKAGE_INFO", this->Description, "DESCRIPTION");
+    ENFORCE_REQUIRES("PACKAGE_INFO", this->Website, "HOMEPAGE_URL");
     ENFORCE_REQUIRES("PACKAGE_INFO", this->DefaultTargets, "DEFAULT_TARGETS");
     ENFORCE_REQUIRES("PACKAGE_INFO", this->DefaultConfigs,
                      "DEFAULT_CONFIGURATIONS");
@@ -71,6 +73,8 @@ bool cmPackageInfoArguments::Check(cmExecutionStatus& status,
   // Check for incompatible options.
   if (!this->Appendix.empty()) {
     ENFORCE_EXCLUSIVE("APPENDIX", this->Version, "VERSION");
+    ENFORCE_EXCLUSIVE("APPENDIX", this->Description, "DESCRIPTION");
+    ENFORCE_EXCLUSIVE("APPENDIX", this->Website, "HOMEPAGE_URL");
     ENFORCE_EXCLUSIVE("APPENDIX", this->DefaultTargets, "DEFAULT_TARGETS");
     ENFORCE_EXCLUSIVE("APPENDIX", this->DefaultConfigs,
                       "DEFAULT_CONFIGURATIONS");

+ 16 - 4
Tests/RunCMake/ExportPackageInfo/BadArgs2-stderr.txt

@@ -1,22 +1,34 @@
-CMake Error at BadArgs2\.cmake:3 \(export\):
+CMake Error at BadArgs2\.cmake:[0-9]+ \(export\):
   export APPENDIX and VERSION are mutually exclusive\.
 Call Stack \(most recent call first\):
   CMakeLists\.txt:3 \(include\)
 
 
-CMake Error at BadArgs2\.cmake:4 \(export\):
+CMake Error at BadArgs2\.cmake:[0-9]+ \(export\):
+  export APPENDIX and DESCRIPTION are mutually exclusive\.
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:3 \(include\)
+
+
+CMake Error at BadArgs2\.cmake:[0-9]+ \(export\):
+  export APPENDIX and HOMEPAGE_URL are mutually exclusive\.
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:3 \(include\)
+
+
+CMake Error at BadArgs2\.cmake:[0-9]+ \(export\):
   export APPENDIX and DEFAULT_TARGETS are mutually exclusive\.
 Call Stack \(most recent call first\):
   CMakeLists\.txt:3 \(include\)
 
 
-CMake Error at BadArgs2\.cmake:5 \(export\):
+CMake Error at BadArgs2\.cmake:[0-9]+ \(export\):
   export APPENDIX and DEFAULT_CONFIGURATIONS are mutually exclusive\.
 Call Stack \(most recent call first\):
   CMakeLists\.txt:3 \(include\)
 
 
-CMake Error at BadArgs2\.cmake:6 \(export\):
+CMake Error at BadArgs2\.cmake:[0-9]+ \(export\):
   export APPENDIX and PROJECT are mutually exclusive\.
 Call Stack \(most recent call first\):
   CMakeLists\.txt:3 \(include\)

+ 2 - 0
Tests/RunCMake/ExportPackageInfo/BadArgs2.cmake

@@ -1,6 +1,8 @@
 add_library(foo INTERFACE)
 install(TARGETS foo EXPORT foo DESTINATION .)
 export(EXPORT foo PACKAGE_INFO foo APPENDIX test VERSION 1.0)
+export(EXPORT foo PACKAGE_INFO foo APPENDIX test DESCRIPTION "Test")
+export(EXPORT foo PACKAGE_INFO foo APPENDIX test HOMEPAGE_URL "example.com")
 export(EXPORT foo PACKAGE_INFO foo APPENDIX test DEFAULT_TARGETS foo)
 export(EXPORT foo PACKAGE_INFO foo APPENDIX test DEFAULT_CONFIGURATIONS Release)
 export(EXPORT foo PACKAGE_INFO foo APPENDIX test PROJECT foo)

+ 19 - 7
Tests/RunCMake/ExportPackageInfo/BadArgs4-stderr.txt

@@ -1,40 +1,52 @@
-CMake Error at BadArgs4\.cmake:3 \(export\):
+CMake Error at BadArgs4\.cmake:[0-9]+ \(export\):
   export LOWER_CASE_FILE requires PACKAGE_INFO\.
 Call Stack \(most recent call first\):
   CMakeLists\.txt:3 \(include\)
 
 
-CMake Error at BadArgs4\.cmake:4 \(export\):
+CMake Error at BadArgs4\.cmake:[0-9]+ \(export\):
   export APPENDIX requires PACKAGE_INFO\.
 Call Stack \(most recent call first\):
   CMakeLists\.txt:3 \(include\)
 
 
-CMake Error at BadArgs4\.cmake:5 \(export\):
+CMake Error at BadArgs4\.cmake:[0-9]+ \(export\):
   export VERSION requires PACKAGE_INFO\.
 Call Stack \(most recent call first\):
   CMakeLists\.txt:3 \(include\)
 
 
-CMake Error at BadArgs4\.cmake:6 \(export\):
+CMake Error at BadArgs4\.cmake:[0-9]+ \(export\):
+  export DESCRIPTION requires PACKAGE_INFO\.
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:3 \(include\)
+
+
+CMake Error at BadArgs4\.cmake:[0-9]+ \(export\):
+  export HOMEPAGE_URL requires PACKAGE_INFO\.
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:3 \(include\)
+
+
+CMake Error at BadArgs4\.cmake:[0-9]+ \(export\):
   export DEFAULT_TARGETS requires PACKAGE_INFO\.
 Call Stack \(most recent call first\):
   CMakeLists\.txt:3 \(include\)
 
 
-CMake Error at BadArgs4\.cmake:7 \(export\):
+CMake Error at BadArgs4\.cmake:[0-9]+ \(export\):
   export DEFAULT_CONFIGURATIONS requires PACKAGE_INFO\.
 Call Stack \(most recent call first\):
   CMakeLists\.txt:3 \(include\)
 
 
-CMake Error at BadArgs4\.cmake:8 \(export\):
+CMake Error at BadArgs4\.cmake:[0-9]+ \(export\):
   export PROJECT requires PACKAGE_INFO\.
 Call Stack \(most recent call first\):
   CMakeLists\.txt:3 \(include\)
 
 
-CMake Error at BadArgs4\.cmake:9 \(export\):
+CMake Error at BadArgs4\.cmake:[0-9]+ \(export\):
   export NO_PROJECT_METADATA requires PACKAGE_INFO\.
 Call Stack \(most recent call first\):
   CMakeLists\.txt:3 \(include\)

+ 2 - 0
Tests/RunCMake/ExportPackageInfo/BadArgs4.cmake

@@ -3,6 +3,8 @@ install(TARGETS foo EXPORT foo DESTINATION .)
 export(EXPORT foo LOWER_CASE_FILE)
 export(EXPORT foo APPENDIX test)
 export(EXPORT foo VERSION 1.0)
+export(EXPORT foo DESCRIPTION "Test")
+export(EXPORT foo HOMEPAGE_URL "example.com")
 export(EXPORT foo DEFAULT_TARGETS foo)
 export(EXPORT foo DEFAULT_CONFIGURATIONS Release)
 export(EXPORT foo PROJECT foo)

+ 16 - 4
Tests/RunCMake/InstallPackageInfo/BadArgs2-stderr.txt

@@ -1,22 +1,34 @@
-CMake Error at BadArgs2.cmake:3 \(install\):
+CMake Error at BadArgs2.cmake:[0-9]+ \(install\):
   install APPENDIX and VERSION are mutually exclusive.
 Call Stack \(most recent call first\):
   CMakeLists\.txt:3 \(include\)
 
 
-CMake Error at BadArgs2.cmake:4 \(install\):
+CMake Error at BadArgs2.cmake:[0-9]+ \(install\):
+  install APPENDIX and DESCRIPTION are mutually exclusive.
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:3 \(include\)
+
+
+CMake Error at BadArgs2.cmake:[0-9]+ \(install\):
+  install APPENDIX and HOMEPAGE_URL are mutually exclusive.
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:3 \(include\)
+
+
+CMake Error at BadArgs2.cmake:[0-9]+ \(install\):
   install APPENDIX and DEFAULT_TARGETS are mutually exclusive.
 Call Stack \(most recent call first\):
   CMakeLists\.txt:3 \(include\)
 
 
-CMake Error at BadArgs2.cmake:5 \(install\):
+CMake Error at BadArgs2.cmake:[0-9]+ \(install\):
   install APPENDIX and DEFAULT_CONFIGURATIONS are mutually exclusive.
 Call Stack \(most recent call first\):
   CMakeLists\.txt:3 \(include\)
 
 
-CMake Error at BadArgs2.cmake:6 \(install\):
+CMake Error at BadArgs2.cmake:[0-9]+ \(install\):
   install APPENDIX and PROJECT are mutually exclusive.
 Call Stack \(most recent call first\):
   CMakeLists\.txt:3 \(include\)

+ 2 - 0
Tests/RunCMake/InstallPackageInfo/BadArgs2.cmake

@@ -1,6 +1,8 @@
 add_library(foo INTERFACE)
 install(TARGETS foo EXPORT foo DESTINATION .)
 install(PACKAGE_INFO test EXPORT foo APPENDIX test VERSION 1.0)
+install(PACKAGE_INFO test EXPORT foo APPENDIX test DESCRIPTION "Test")
+install(PACKAGE_INFO test EXPORT foo APPENDIX test HOMEPAGE_URL "example.com")
 install(PACKAGE_INFO test EXPORT foo APPENDIX test DEFAULT_TARGETS foo)
 install(PACKAGE_INFO test EXPORT foo APPENDIX test DEFAULT_CONFIGURATIONS test)
 install(PACKAGE_INFO test EXPORT foo APPENDIX test PROJECT foo)