Jelajahi Sumber

add_library: Issue better diagnostic for INTERFACE GLOBAL signature.

Stephen Kelly 11 tahun lalu
induk
melakukan
6d85a6a64c

+ 7 - 0
Source/cmAddLibraryCommand.cxx

@@ -173,6 +173,13 @@ bool cmAddLibraryCommand
       ++s;
       importGlobal = true;
       }
+    else if(type == cmTarget::INTERFACE_LIBRARY && *s == "GLOBAL")
+      {
+      cmOStringStream e;
+      e << "GLOBAL option may only be used with IMPORTED libraries.";
+      this->SetError(e.str().c_str());
+      return false;
+      }
     else
       {
       break;

+ 1 - 1
Tests/RunCMake/interface_library/invalid_signature-stderr.txt

@@ -84,6 +84,6 @@ Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)
 +
 CMake Error at invalid_signature.cmake:20 \(add_library\):
-  add_library INTERFACE library requires no source arguments.
+  add_library GLOBAL option may only be used with IMPORTED libraries.
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)