BUG: _LINK_TYPE cache variable should never be switched from optimized to debug or vice versa.

This commit is contained in:
Brad King 2004-04-02 13:21:20 -05:00
parent 51cb75d454
commit 5c9fadee4f

View File

@ -346,19 +346,46 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf,
if(llt != cmTarget::GENERAL) 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; std::string linkTypeName = lib;
linkTypeName += "_LINK_TYPE"; linkTypeName += "_LINK_TYPE";
switch(llt) switch(llt)
{ {
case cmTarget::DEBUG: case cmTarget::DEBUG:
mf.AddCacheDefinition(linkTypeName.c_str(), {
"debug", "Library is used for debug links only", const char* def = mf.GetDefinition(linkTypeName.c_str());
cmCacheManager::STATIC); if(!def || strcmp(def, "debug") == 0)
break; {
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: case cmTarget::OPTIMIZED:
mf.AddCacheDefinition(linkTypeName.c_str(), {
"optimized", "Library is used for debug links only", const char* def = mf.GetDefinition(linkTypeName.c_str());
cmCacheManager::STATIC); 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; break;
case cmTarget::GENERAL: break; case cmTarget::GENERAL: break;
} }