summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2006-05-19 17:02:12 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2006-05-19 17:02:12 (GMT)
commit0f2f0749785ab76a30a55b9a4764ecaac39776b6 (patch)
tree98043aca1c247239245dee20a04204ca6f222360 /Source
parentc8c3fff032dd5a582fa08dcd1034f9f92dc07244 (diff)
downloadCMake-0f2f0749785ab76a30a55b9a4764ecaac39776b6.zip
CMake-0f2f0749785ab76a30a55b9a4764ecaac39776b6.tar.gz
CMake-0f2f0749785ab76a30a55b9a4764ecaac39776b6.tar.bz2
ENH: fix for vtk 4.4 and other projects that may try to link to a module
Diffstat (limited to 'Source')
-rw-r--r--Source/cmMakefile.cxx31
-rw-r--r--Source/cmTarget.cxx5
-rw-r--r--Source/cmTarget.h2
3 files changed, 31 insertions, 7 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index cbb7c21..79098ac 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -824,16 +824,35 @@ void cmMakefile::AddLinkLibraryForTarget(const char *target,
this->GetCMakeInstance()->GetGlobalGenerator()->FindTarget(0, lib);
if(tgt)
{
+ bool allowModules = true;
+ const char* versionValue
+ = this->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
+ if (versionValue && (atof(versionValue) >= 2.4) )
+ {
+ allowModules = false;
+ }
// if it is not a static or shared library then you can not link to it
if(!((tgt->GetType() == cmTarget::STATIC_LIBRARY) ||
(tgt->GetType() == cmTarget::SHARED_LIBRARY)))
- {
+ {
cmOStringStream e;
- e << "Attempt to add link library " << lib
- << " which is not a library target to target "
- << tgt->GetType() << " " <<
- target << "\n";
- cmSystemTools::Error(e.str().c_str());
+ e << "Attempt to add link target " << lib << " of type: "
+ << cmTarget::TargetTypeNames[(int)tgt->GetType()]
+ << "\nto target " << target
+ << ". You can only link to STATIC or SHARED libraries.";
+ // in older versions of cmake linking to modules was allowed
+ if( tgt->GetType() == cmTarget::MODULE_LIBRARY )
+ {
+ e << "\nTo allow linking of modules set CMAKE_BACKWARDS_COMPATIBILITY to 2.2 or lower\n";
+ }
+ // if no modules are allowed then this is always an error
+ if(!allowModules ||
+ // if we allow modules but the type is not a module then it is
+ // still an error
+ (allowModules && tgt->GetType() != cmTarget::MODULE_LIBRARY))
+ {
+ cmSystemTools::Error(e.str().c_str());
+ }
}
}
i->second.AddLinkLibrary( *this, target, lib, llt );
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 0f34a97..1c88eb7 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -23,6 +23,11 @@
#include <set>
#include <queue>
#include <stdlib.h> // required for atof
+const char* cmTarget::TargetTypeNames[] = {
+ "EXECUTABLE", "STATIC_LIBRARY",
+ "SHARED_LIBRARY", "MODULE_LIBRARY", "UTILITY", "GLOBAL_TARGET",
+ "INSTALL_FILES", "INSTALL_PROGRAMS", "INSTALL_DIRECTORY"
+};
//----------------------------------------------------------------------------
cmTarget::cmTarget()
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index cc39572..8b05958 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -36,7 +36,7 @@ public:
enum TargetType { EXECUTABLE, STATIC_LIBRARY,
SHARED_LIBRARY, MODULE_LIBRARY, UTILITY, GLOBAL_TARGET,
INSTALL_FILES, INSTALL_PROGRAMS, INSTALL_DIRECTORY};
-
+ static const char* TargetTypeNames[];
enum CustomCommandType { PRE_BUILD, PRE_LINK, POST_BUILD };
/**