VS6: Compute CMAKE_*_FLAGS and COMPILE_DEFINITIONS* only when needed
These placeholders are used only in the .dsp templates for targets that actually compile sources.
This commit is contained in:
parent
df5def5334
commit
4a0128f42f
@ -1701,15 +1701,15 @@ void cmLocalVisualStudio6Generator
|
|||||||
= this->Makefile->GetDefinition("CMAKE_DEBUG_POSTFIX");
|
= this->Makefile->GetDefinition("CMAKE_DEBUG_POSTFIX");
|
||||||
cmSystemTools::ReplaceString(line, "DEBUG_POSTFIX",
|
cmSystemTools::ReplaceString(line, "DEBUG_POSTFIX",
|
||||||
debugPostfix?debugPostfix:"");
|
debugPostfix?debugPostfix:"");
|
||||||
|
if(target.GetType() >= cmTarget::EXECUTABLE &&
|
||||||
|
target.GetType() <= cmTarget::OBJECT_LIBRARY)
|
||||||
|
{
|
||||||
// store flags for each configuration
|
// store flags for each configuration
|
||||||
std::string flags = " ";
|
std::string flags = " ";
|
||||||
std::string flagsRelease = " ";
|
std::string flagsRelease = " ";
|
||||||
std::string flagsMinSizeRel = " ";
|
std::string flagsMinSizeRel = " ";
|
||||||
std::string flagsDebug = " ";
|
std::string flagsDebug = " ";
|
||||||
std::string flagsRelWithDebInfo = " ";
|
std::string flagsRelWithDebInfo = " ";
|
||||||
if(target.GetType() >= cmTarget::EXECUTABLE &&
|
|
||||||
target.GetType() <= cmTarget::OBJECT_LIBRARY)
|
|
||||||
{
|
|
||||||
std::vector<std::string> configs;
|
std::vector<std::string> configs;
|
||||||
target.GetMakefile()->GetConfigurations(configs);
|
target.GetMakefile()->GetConfigurations(configs);
|
||||||
std::vector<std::string>::const_iterator it = configs.begin();
|
std::vector<std::string>::const_iterator it = configs.begin();
|
||||||
@ -1760,7 +1760,6 @@ void cmLocalVisualStudio6Generator
|
|||||||
"MinSizeRel");
|
"MinSizeRel");
|
||||||
this->AddCompileOptions(flagsRelWithDebInfo, &target, linkLanguage,
|
this->AddCompileOptions(flagsRelWithDebInfo, &target, linkLanguage,
|
||||||
"RelWithDebInfo");
|
"RelWithDebInfo");
|
||||||
}
|
|
||||||
|
|
||||||
// if _UNICODE and _SBCS are not found, then add -D_MBCS
|
// if _UNICODE and _SBCS are not found, then add -D_MBCS
|
||||||
std::string defs = this->Makefile->GetDefineFlags();
|
std::string defs = this->Makefile->GetDefineFlags();
|
||||||
@ -1780,10 +1779,14 @@ void cmLocalVisualStudio6Generator
|
|||||||
std::set<std::string> debugrelDefinesSet;
|
std::set<std::string> debugrelDefinesSet;
|
||||||
|
|
||||||
this->AddCompileDefinitions(definesSet, &target, "");
|
this->AddCompileDefinitions(definesSet, &target, "");
|
||||||
this->AddCompileDefinitions(debugDefinesSet, &target, "DEBUG");
|
this->AddCompileDefinitions(debugDefinesSet, &target,
|
||||||
this->AddCompileDefinitions(releaseDefinesSet, &target, "RELEASE");
|
"DEBUG");
|
||||||
this->AddCompileDefinitions(minsizeDefinesSet, &target, "MINSIZEREL");
|
this->AddCompileDefinitions(releaseDefinesSet, &target,
|
||||||
this->AddCompileDefinitions(debugrelDefinesSet, &target, "RELWITHDEBINFO");
|
"RELEASE");
|
||||||
|
this->AddCompileDefinitions(minsizeDefinesSet, &target,
|
||||||
|
"MINSIZEREL");
|
||||||
|
this->AddCompileDefinitions(debugrelDefinesSet, &target,
|
||||||
|
"RELWITHDEBINFO");
|
||||||
|
|
||||||
std::string defines = " ";
|
std::string defines = " ";
|
||||||
std::string debugDefines = " ";
|
std::string debugDefines = " ";
|
||||||
@ -1805,8 +1808,8 @@ void cmLocalVisualStudio6Generator
|
|||||||
|
|
||||||
// The template files have CXX FLAGS in them, that need to be replaced.
|
// The template files have CXX FLAGS in them, that need to be replaced.
|
||||||
// There are not separate CXX and C template files, so we use the same
|
// There are not separate CXX and C template files, so we use the same
|
||||||
// variable names. The previous code sets up flags* variables to contain
|
// variable names. The previous code sets up flags* variables to
|
||||||
// the correct C or CXX flags
|
// contain the correct C or CXX flags
|
||||||
cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_MINSIZEREL",
|
cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_MINSIZEREL",
|
||||||
flagsMinSizeRel.c_str());
|
flagsMinSizeRel.c_str());
|
||||||
cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_DEBUG",
|
cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_DEBUG",
|
||||||
@ -1825,7 +1828,9 @@ void cmLocalVisualStudio6Generator
|
|||||||
debugrelDefines.c_str());
|
debugrelDefines.c_str());
|
||||||
cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELEASE",
|
cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELEASE",
|
||||||
releaseDefines.c_str());
|
releaseDefines.c_str());
|
||||||
cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS", defines.c_str());
|
cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS",
|
||||||
|
defines.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
fout << line.c_str() << std::endl;
|
fout << line.c_str() << std::endl;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user