Merge topic 'interface-library-signatures'

6d85a6a6 add_library: Issue better diagnostic for INTERFACE GLOBAL signature.
770245e9 add_library: Test invalid GLOBAL INTERFACE signature.
This commit is contained in:
Brad King 2014-02-10 11:24:54 -05:00 committed by CMake Topic Stage
commit 6e149e1591
7 changed files with 22 additions and 2 deletions

View File

@ -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;

View File

@ -5,5 +5,6 @@ run_cmake(target_commands)
run_cmake(no_shared_libs)
run_cmake(whitelist)
run_cmake(invalid_signature)
run_cmake(global-interface)
run_cmake(genex_link)
run_cmake(add_dependencies)

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,9 @@
CMake Error at global-interface.cmake:2 \(add_library\):
Cannot find source file:
GLOBAL
Tried extensions \.c \.C \.c\+\+ \.cc \.cpp \.cxx \.m \.M \.mm \.h \.hh \.h\+\+ \.hm \.hpp
\.hxx \.in \.txx
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@ -0,0 +1,2 @@
add_library(iface GLOBAL INTERFACE)

View File

@ -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\)

View File

@ -16,5 +16,5 @@ add_library(iface15 ALIAS INTERFACE)
add_library(iface16 INTERFACE INTERFACE)
add_library(iface17 INTERFACE EXCLUDE_FROM_ALL)
add_library(iface18 EXCLUDE_FROM_ALL INTERFACE)
add_library(iface19 GLOBAL INTERFACE)
# add_library(iface19 GLOBAL INTERFACE) Tested separately
add_library(iface20 INTERFACE GLOBAL)