add_library: Allow OBJECT library without dynamic linking (#13289)
When global property TARGET_SUPPORTS_SHARED_LIBS is FALSE we should
still allow OBJECT libraries. This was an oversight in commit b87d7a60
(Add OBJECT_LIBRARY target type, 2012-03-12). While at it, fix the
warning message to report context.
This commit is contained in:
parent
d17c58c853
commit
9a9b3e45e3
|
@ -102,16 +102,17 @@ bool cmAddLibraryCommand
|
||||||
STATIC. But at this point we know only the name of the target, but not
|
STATIC. But at this point we know only the name of the target, but not
|
||||||
yet its linker language. */
|
yet its linker language. */
|
||||||
if ((type != cmTarget::STATIC_LIBRARY) &&
|
if ((type != cmTarget::STATIC_LIBRARY) &&
|
||||||
|
(type != cmTarget::OBJECT_LIBRARY) &&
|
||||||
(this->Makefile->GetCMakeInstance()->GetPropertyAsBool(
|
(this->Makefile->GetCMakeInstance()->GetPropertyAsBool(
|
||||||
"TARGET_SUPPORTS_SHARED_LIBS") == false))
|
"TARGET_SUPPORTS_SHARED_LIBS") == false))
|
||||||
{
|
{
|
||||||
std::string msg = "ADD_LIBRARY for library ";
|
cmOStringStream w;
|
||||||
msg += args[0];
|
w <<
|
||||||
msg += " is used with the ";
|
"ADD_LIBRARY called with " <<
|
||||||
msg += type==cmTarget::SHARED_LIBRARY ? "SHARED" : "MODULE";
|
(type==cmTarget::SHARED_LIBRARY ? "SHARED" : "MODULE") <<
|
||||||
msg += " option, but the target platform supports only STATIC libraries. "
|
" option but the target platform does not support dynamic linking. "
|
||||||
"Building it STATIC instead. This may lead to problems.";
|
"Building a STATIC library instead. This may lead to problems.";
|
||||||
cmSystemTools::Message(msg.c_str() ,"Warning");
|
this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
|
||||||
type = cmTarget::STATIC_LIBRARY;
|
type = cmTarget::STATIC_LIBRARY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue