diff options
7 files changed, 22 insertions, 2 deletions
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index a29f784..009b1ca 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/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; diff --git a/Tests/RunCMake/interface_library/RunCMakeTest.cmake b/Tests/RunCMake/interface_library/RunCMakeTest.cmake index 9ca9a77..3c457c5 100644 --- a/Tests/RunCMake/interface_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/interface_library/RunCMakeTest.cmake @@ -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) diff --git a/Tests/RunCMake/interface_library/global-interface-result.txt b/Tests/RunCMake/interface_library/global-interface-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/interface_library/global-interface-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/interface_library/global-interface-stderr.txt b/Tests/RunCMake/interface_library/global-interface-stderr.txt new file mode 100644 index 0000000..24edd0f --- /dev/null +++ b/Tests/RunCMake/interface_library/global-interface-stderr.txt @@ -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\) diff --git a/Tests/RunCMake/interface_library/global-interface.cmake b/Tests/RunCMake/interface_library/global-interface.cmake new file mode 100644 index 0000000..d2bfc64 --- /dev/null +++ b/Tests/RunCMake/interface_library/global-interface.cmake @@ -0,0 +1,2 @@ + +add_library(iface GLOBAL INTERFACE) diff --git a/Tests/RunCMake/interface_library/invalid_signature-stderr.txt b/Tests/RunCMake/interface_library/invalid_signature-stderr.txt index 701586a..6374b33 100644 --- a/Tests/RunCMake/interface_library/invalid_signature-stderr.txt +++ b/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\) diff --git a/Tests/RunCMake/interface_library/invalid_signature.cmake b/Tests/RunCMake/interface_library/invalid_signature.cmake index 67e3267..4e53534 100644 --- a/Tests/RunCMake/interface_library/invalid_signature.cmake +++ b/Tests/RunCMake/interface_library/invalid_signature.cmake @@ -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) |