summaryrefslogtreecommitdiff
path: root/Source/cmAddLibraryCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-12-03 08:50:05 -0500
committerBrad King <brad.king@kitware.com>2014-12-03 08:51:11 -0500
commitbd360ee329e74487dba526d7847794bc66b55494 (patch)
tree2ab286d7f923b55388424ddd692b7ac7ee2d4469 /Source/cmAddLibraryCommand.cxx
parent722178fc7ef47020323af4a97dc5600e43652a2b (diff)
downloadcmake-bd360ee329e74487dba526d7847794bc66b55494.tar.gz
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>
Diffstat (limited to 'Source/cmAddLibraryCommand.cxx')
-rw-r--r--Source/cmAddLibraryCommand.cxx5
1 files changed, 2 insertions, 3 deletions
diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx
index cdc9f2ad77..bba4d41440 100644
--- a/Source/cmAddLibraryCommand.cxx
+++ b/Source/cmAddLibraryCommand.cxx
@@ -328,9 +328,8 @@ bool cmAddLibraryCommand
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
yet its linker language. */
- if ((type != cmTarget::STATIC_LIBRARY) &&
- (type != cmTarget::OBJECT_LIBRARY) &&
- (type != cmTarget::INTERFACE_LIBRARY) &&
+ if ((type == cmTarget::SHARED_LIBRARY ||
+ type == cmTarget::MODULE_LIBRARY) &&
(this->Makefile->GetCMakeInstance()->GetPropertyAsBool(
"TARGET_SUPPORTS_SHARED_LIBS") == false))
{