summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-08-18 15:39:22 (GMT)
committerBrad King <brad.king@kitware.com>2008-08-18 15:39:22 (GMT)
commit061d20be3869d53e0dee4c72b4f9e0202fe6b197 (patch)
treee3b1e82517d89a5795e6d1927e49de21d0294983 /Source/cmTarget.cxx
parent0bf093fd172951a8da7fc892da95c5c37a3354e2 (diff)
downloadCMake-061d20be3869d53e0dee4c72b4f9e0202fe6b197.zip
CMake-061d20be3869d53e0dee4c72b4f9e0202fe6b197.tar.gz
CMake-061d20be3869d53e0dee4c72b4f9e0202fe6b197.tar.bz2
ENH: Add UNKNOWN type for IMPORTED libraries
When creating an IMPORTED target for a library that has been found on disk, it may not be known whether the library is STATIC or SHARED. However, the library may still be linked using the file found from disk. Use of an IMPORTED target is still important to allow per-configuration files to be specified for the library. This change creates an UNKNOWN type for IMPORTED library targets. The IMPORTED_LOCATION property (and its per-config equivalents) specifies the location of the library. CMake makes no assumptions about the library that cannot be inferred from the file on disk. This will help projects and find-modules import targets found on disk or specified by the user.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx20
1 files changed, 18 insertions, 2 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index caa534f..296e93d 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -30,7 +30,8 @@
const char* cmTarget::TargetTypeNames[] = {
"EXECUTABLE", "STATIC_LIBRARY",
"SHARED_LIBRARY", "MODULE_LIBRARY", "UTILITY", "GLOBAL_TARGET",
- "INSTALL_FILES", "INSTALL_PROGRAMS", "INSTALL_DIRECTORY"
+ "INSTALL_FILES", "INSTALL_PROGRAMS", "INSTALL_DIRECTORY",
+ "UNKNOWN_LIBRARY"
};
//----------------------------------------------------------------------------
@@ -277,6 +278,7 @@ void cmTarget::DefineProperties(cmake *cm)
"For frameworks on OS X this is the location of the library file "
"symlink just inside the framework folder. "
"For DLLs this is the location of the \".dll\" part of the library. "
+ "For UNKNOWN libraries this is the location of the file to be linked. "
"Ignored for non-imported targets.");
cm->DefineProperty
@@ -787,6 +789,16 @@ bool cmTarget::IsExecutableWithExports()
}
//----------------------------------------------------------------------------
+bool cmTarget::IsLinkable()
+{
+ return (this->GetType() == cmTarget::STATIC_LIBRARY ||
+ this->GetType() == cmTarget::SHARED_LIBRARY ||
+ this->GetType() == cmTarget::MODULE_LIBRARY ||
+ this->GetType() == cmTarget::UNKNOWN_LIBRARY ||
+ this->IsExecutableWithExports());
+}
+
+//----------------------------------------------------------------------------
bool cmTarget::IsFrameworkOnApple()
{
return (this->GetType() == cmTarget::SHARED_LIBRARY &&
@@ -1860,7 +1872,8 @@ const char *cmTarget::GetProperty(const char* prop,
if(this->GetType() == cmTarget::EXECUTABLE ||
this->GetType() == cmTarget::STATIC_LIBRARY ||
this->GetType() == cmTarget::SHARED_LIBRARY ||
- this->GetType() == cmTarget::MODULE_LIBRARY)
+ this->GetType() == cmTarget::MODULE_LIBRARY ||
+ this->GetType() == cmTarget::UNKNOWN_LIBRARY)
{
if(!this->IsImported() && strcmp(prop,"LOCATION") == 0)
{
@@ -1957,6 +1970,9 @@ const char *cmTarget::GetProperty(const char* prop,
case cmTarget::INSTALL_DIRECTORY:
return "INSTALL_DIRECTORY";
// break; /* unreachable */
+ case cmTarget::UNKNOWN_LIBRARY:
+ return "UNKNOWN_LIBRARY";
+ // break; /* unreachable */
}
return 0;
}