summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2004-04-02 18:21:20 (GMT)
committerBrad King <brad.king@kitware.com>2004-04-02 18:21:20 (GMT)
commit5c9fadee4f072fc4271fa8eeb05e8878d4bdfbca (patch)
treebdb9c7d4f6f19743955e42912e88e6833eba6657 /Source/cmTarget.cxx
parent51cb75d454bd95d67179594fbe0fd9c9baaf2e7b (diff)
downloadCMake-5c9fadee4f072fc4271fa8eeb05e8878d4bdfbca.zip
CMake-5c9fadee4f072fc4271fa8eeb05e8878d4bdfbca.tar.gz
CMake-5c9fadee4f072fc4271fa8eeb05e8878d4bdfbca.tar.bz2
BUG: _LINK_TYPE cache variable should never be switched from optimized to debug or vice versa.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx41
1 files changed, 34 insertions, 7 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 6481d47..252d678 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -346,19 +346,46 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf,
if(llt != cmTarget::GENERAL)
{
+ // Store the library's link type in the cache. If it is a
+ // conflicting type then assume it is always used. This is the
+ // case when the user sets the cache entries for debug and
+ // optimized versions of the library to the same value.
std::string linkTypeName = lib;
linkTypeName += "_LINK_TYPE";
switch(llt)
{
case cmTarget::DEBUG:
- mf.AddCacheDefinition(linkTypeName.c_str(),
- "debug", "Library is used for debug links only",
- cmCacheManager::STATIC);
- break;
+ {
+ const char* def = mf.GetDefinition(linkTypeName.c_str());
+ if(!def || strcmp(def, "debug") == 0)
+ {
+ mf.AddCacheDefinition(linkTypeName.c_str(),
+ "debug", "Library is used for debug links only",
+ cmCacheManager::STATIC);
+ }
+ else
+ {
+ mf.AddCacheDefinition(linkTypeName.c_str(),
+ "general", "Library is used for both debug and optimized links",
+ cmCacheManager::STATIC);
+ }
+ } break;
case cmTarget::OPTIMIZED:
- mf.AddCacheDefinition(linkTypeName.c_str(),
- "optimized", "Library is used for debug links only",
- cmCacheManager::STATIC);
+ {
+ const char* def = mf.GetDefinition(linkTypeName.c_str());
+ if(!def || strcmp(def, "optimized") == 0)
+ {
+ mf.AddCacheDefinition(linkTypeName.c_str(),
+ "optimized", "Library is used for debug links only",
+ cmCacheManager::STATIC);
+ }
+ else
+ {
+ mf.AddCacheDefinition(linkTypeName.c_str(),
+ "general", "Library is used for both debug and optimized links",
+ cmCacheManager::STATIC);
+ }
+ } break;
break;
case cmTarget::GENERAL: break;
}