add_library: Fix target type check for non-shared-lib platforms
When checking target types for TARGET_SUPPORTS_SHARED_LIBS == false, enumerate exactly the library types not supported rather than trying to maintain a list of all the types that are supported. Otherwise add_library(SomeImportedLib UNKNOWN IMPORTED) warns on platforms that do not support shared libraries. Reported-by: Kelly Thompson <kgt@lanl.gov>
This commit is contained in:
parent
722178fc7e
commit
bd360ee329
|
@ -328,9 +328,8 @@ bool cmAddLibraryCommand
|
||||||
CMAKE_${LANG}_CREATE_SHARED_LIBRARY is defined and if not default to
|
CMAKE_${LANG}_CREATE_SHARED_LIBRARY is defined and if not default to
|
||||||
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::SHARED_LIBRARY ||
|
||||||
(type != cmTarget::OBJECT_LIBRARY) &&
|
type == cmTarget::MODULE_LIBRARY) &&
|
||||||
(type != cmTarget::INTERFACE_LIBRARY) &&
|
|
||||||
(this->Makefile->GetCMakeInstance()->GetPropertyAsBool(
|
(this->Makefile->GetCMakeInstance()->GetPropertyAsBool(
|
||||||
"TARGET_SUPPORTS_SHARED_LIBS") == false))
|
"TARGET_SUPPORTS_SHARED_LIBS") == false))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue