target_link_libraries: Slightly fix some error-messages.

Some error-messages are slightly adjusted to better tell what
invocation would be correct instead. Tests are adjusted accordingly.
This commit is contained in:
Deniz Bahadir
2017-11-27 22:11:11 +01:00
parent 85457b63c8
commit b0e2f1415e
3 changed files with 17 additions and 17 deletions

View File

@@ -160,8 +160,9 @@ bool cmTargetLinkLibrariesCommand::InitialPass(
this->CurrentProcessingState != ProcessingKeywordPublicInterface &&
this->CurrentProcessingState != ProcessingKeywordLinkInterface) {
this->Makefile->IssueMessage(
cmake::FATAL_ERROR, "The INTERFACE option must appear as the second "
"argument, just after the target name.");
cmake::FATAL_ERROR,
"The INTERFACE, PUBLIC or PRIVATE option must appear as the second "
"argument, just after the target name.");
return true;
}
this->CurrentProcessingState = ProcessingKeywordLinkInterface;
@@ -183,7 +184,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass(
this->CurrentProcessingState != ProcessingKeywordLinkInterface) {
this->Makefile->IssueMessage(
cmake::FATAL_ERROR,
"The PUBLIC or PRIVATE option must appear as the second "
"The INTERFACE, PUBLIC or PRIVATE option must appear as the second "
"argument, just after the target name.");
return true;
}
@@ -206,7 +207,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass(
this->CurrentProcessingState != ProcessingKeywordLinkInterface) {
this->Makefile->IssueMessage(
cmake::FATAL_ERROR,
"The PUBLIC or PRIVATE option must appear as the second "
"The INTERFACE, PUBLIC or PRIVATE option must appear as the second "
"argument, just after the target name.");
return true;
}
@@ -349,12 +350,11 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
// form must be the plain form.
const char* existingSig =
(sig == cmTarget::KeywordTLLSignature ? "plain" : "keyword");
e << "The " << existingSig << " signature for target_link_libraries "
"has already been used with the target \""
<< this->Target->GetName() << "\". All uses of "
"target_link_libraries with a target "
<< modal << " be either "
"all-keyword or all-plain.\n";
e << "The " << existingSig << " signature for target_link_libraries has "
"already been used with the target \""
<< this->Target->GetName()
<< "\". All uses of target_link_libraries with a target " << modal
<< " be either all-keyword or all-plain.\n";
this->Target->GetTllSignatureTraces(e,
sig == cmTarget::KeywordTLLSignature
? cmTarget::PlainTLLSignature
@@ -401,9 +401,9 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib,
std::ostringstream e;
e << "Target \"" << lib << "\" of type "
<< cmState::GetTargetTypeName(tgt->GetType())
<< " may not be linked into another target. "
<< "One may link only to STATIC or SHARED libraries, or "
<< "to executables with the ENABLE_EXPORTS property set.";
<< " may not be linked into another target. One may link only to "
"INTERFACE, STATIC or SHARED libraries, or to executables with the "
"ENABLE_EXPORTS property set.";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
}

View File

@@ -1,6 +1,6 @@
CMake Error at LinkObjRHS1.cmake:3 \(target_link_libraries\):
Target "AnObjLib" of type OBJECT_LIBRARY may not be linked into another
target. One may link only to STATIC or SHARED libraries, or to executables
with the ENABLE_EXPORTS property set.
target. One may link only to INTERFACE, STATIC or SHARED libraries, or to
executables with the ENABLE_EXPORTS property set.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)

View File

@@ -1,5 +1,5 @@
CMake Error at MixedSignature.cmake:6 \(target_link_libraries\):
The PUBLIC or PRIVATE option must appear as the second argument, just after
the target name.
The INTERFACE, PUBLIC or PRIVATE option must appear as the second argument,
just after the target name.
Call Stack \(most recent call first\):
CMakeLists.txt:3 \(include\)