Document target_link_libraries target scope (#11058)
The target_link_libraries command requires its first argument to be a target in the current directory. Document this and update the error message to be more specific. While at it, format the error message with a call stack.
This commit is contained in:
parent
a14a8562ea
commit
999ce0aa9c
|
@ -1364,8 +1364,8 @@ void cmMakefile::AddLinkLibraryForTarget(const char *target,
|
||||||
cmOStringStream e;
|
cmOStringStream e;
|
||||||
e << "Attempt to add link library \""
|
e << "Attempt to add link library \""
|
||||||
<< lib << "\" to target \""
|
<< lib << "\" to target \""
|
||||||
<< target << "\" which is not built by this project.";
|
<< target << "\" which is not built in this directory.";
|
||||||
cmSystemTools::Error(e.str().c_str());
|
this->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,10 @@ public:
|
||||||
" target_link_libraries(<target> [item1 [item2 [...]]]\n"
|
" target_link_libraries(<target> [item1 [item2 [...]]]\n"
|
||||||
" [[debug|optimized|general] <item>] ...)\n"
|
" [[debug|optimized|general] <item>] ...)\n"
|
||||||
"Specify libraries or flags to use when linking a given target. "
|
"Specify libraries or flags to use when linking a given target. "
|
||||||
|
"The named <target> must have been created in the current directory "
|
||||||
|
"by a command such as add_executable or add_library. "
|
||||||
|
"The remaining arguments specify library names or flags."
|
||||||
|
"\n"
|
||||||
"If a library name matches that of another target in the project "
|
"If a library name matches that of another target in the project "
|
||||||
"a dependency will automatically be added in the build system to make "
|
"a dependency will automatically be added in the build system to make "
|
||||||
"sure the library being linked is up-to-date before the target links. "
|
"sure the library being linked is up-to-date before the target links. "
|
||||||
|
|
Loading…
Reference in New Issue