summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-03-05 21:50:07 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-03-07 12:19:40 (GMT)
commit4a0128f42feb7da9b6bebe0c2c3aa7a756b96822 (patch)
treef2feb6cee8dbe62569df05eab76ad759d483ebaf /Source
parentdf5def5334249eb01195c1f24f3e728519dc742c (diff)
downloadCMake-4a0128f42feb7da9b6bebe0c2c3aa7a756b96822.zip
CMake-4a0128f42feb7da9b6bebe0c2c3aa7a756b96822.tar.gz
CMake-4a0128f42feb7da9b6bebe0c2c3aa7a756b96822.tar.bz2
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.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx145
1 files changed, 75 insertions, 70 deletions
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 1d62093..0848b03 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -1701,15 +1701,15 @@ void cmLocalVisualStudio6Generator
= this->Makefile->GetDefinition("CMAKE_DEBUG_POSTFIX");
cmSystemTools::ReplaceString(line, "DEBUG_POSTFIX",
debugPostfix?debugPostfix:"");
- // store flags for each configuration
- std::string flags = " ";
- std::string flagsRelease = " ";
- std::string flagsMinSizeRel = " ";
- std::string flagsDebug = " ";
- std::string flagsRelWithDebInfo = " ";
if(target.GetType() >= cmTarget::EXECUTABLE &&
target.GetType() <= cmTarget::OBJECT_LIBRARY)
{
+ // store flags for each configuration
+ std::string flags = " ";
+ std::string flagsRelease = " ";
+ std::string flagsMinSizeRel = " ";
+ std::string flagsDebug = " ";
+ std::string flagsRelWithDebInfo = " ";
std::vector<std::string> configs;
target.GetMakefile()->GetConfigurations(configs);
std::vector<std::string>::const_iterator it = configs.begin();
@@ -1760,72 +1760,77 @@ void cmLocalVisualStudio6Generator
"MinSizeRel");
this->AddCompileOptions(flagsRelWithDebInfo, &target, linkLanguage,
"RelWithDebInfo");
- }
- // if _UNICODE and _SBCS are not found, then add -D_MBCS
- std::string defs = this->Makefile->GetDefineFlags();
- if(flags.find("D_UNICODE") == flags.npos &&
- defs.find("D_UNICODE") == flags.npos &&
- flags.find("D_SBCS") == flags.npos &&
- defs.find("D_SBCS") == flags.npos)
- {
- flags += " /D \"_MBCS\"";
- }
+ // if _UNICODE and _SBCS are not found, then add -D_MBCS
+ std::string defs = this->Makefile->GetDefineFlags();
+ if(flags.find("D_UNICODE") == flags.npos &&
+ defs.find("D_UNICODE") == flags.npos &&
+ flags.find("D_SBCS") == flags.npos &&
+ defs.find("D_SBCS") == flags.npos)
+ {
+ flags += " /D \"_MBCS\"";
+ }
- // Add per-target and per-configuration preprocessor definitions.
- std::set<std::string> definesSet;
- std::set<std::string> debugDefinesSet;
- std::set<std::string> releaseDefinesSet;
- std::set<std::string> minsizeDefinesSet;
- std::set<std::string> debugrelDefinesSet;
-
- this->AddCompileDefinitions(definesSet, &target, "");
- this->AddCompileDefinitions(debugDefinesSet, &target, "DEBUG");
- this->AddCompileDefinitions(releaseDefinesSet, &target, "RELEASE");
- this->AddCompileDefinitions(minsizeDefinesSet, &target, "MINSIZEREL");
- this->AddCompileDefinitions(debugrelDefinesSet, &target, "RELWITHDEBINFO");
-
- std::string defines = " ";
- std::string debugDefines = " ";
- std::string releaseDefines = " ";
- std::string minsizeDefines = " ";
- std::string debugrelDefines = " ";
-
- this->JoinDefines(definesSet, defines, "");
- this->JoinDefines(debugDefinesSet, debugDefines, "");
- this->JoinDefines(releaseDefinesSet, releaseDefines, "");
- this->JoinDefines(minsizeDefinesSet, minsizeDefines, "");
- this->JoinDefines(debugrelDefinesSet, debugrelDefines, "");
-
- flags += defines;
- flagsDebug += debugDefines;
- flagsRelease += releaseDefines;
- flagsMinSizeRel += minsizeDefines;
- flagsRelWithDebInfo += debugrelDefines;
-
- // 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
- // variable names. The previous code sets up flags* variables to contain
- // the correct C or CXX flags
- cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_MINSIZEREL",
- flagsMinSizeRel.c_str());
- cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_DEBUG",
- flagsDebug.c_str());
- cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELWITHDEBINFO",
- flagsRelWithDebInfo.c_str());
- cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELEASE",
- flagsRelease.c_str());
- cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS", flags.c_str());
-
- cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_MINSIZEREL",
- minsizeDefines.c_str());
- cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_DEBUG",
- debugDefines.c_str());
- cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELWITHDEBINFO",
- debugrelDefines.c_str());
- cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELEASE",
- releaseDefines.c_str());
- cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS", defines.c_str());
+ // Add per-target and per-configuration preprocessor definitions.
+ std::set<std::string> definesSet;
+ std::set<std::string> debugDefinesSet;
+ std::set<std::string> releaseDefinesSet;
+ std::set<std::string> minsizeDefinesSet;
+ std::set<std::string> debugrelDefinesSet;
+
+ this->AddCompileDefinitions(definesSet, &target, "");
+ this->AddCompileDefinitions(debugDefinesSet, &target,
+ "DEBUG");
+ this->AddCompileDefinitions(releaseDefinesSet, &target,
+ "RELEASE");
+ this->AddCompileDefinitions(minsizeDefinesSet, &target,
+ "MINSIZEREL");
+ this->AddCompileDefinitions(debugrelDefinesSet, &target,
+ "RELWITHDEBINFO");
+
+ std::string defines = " ";
+ std::string debugDefines = " ";
+ std::string releaseDefines = " ";
+ std::string minsizeDefines = " ";
+ std::string debugrelDefines = " ";
+
+ this->JoinDefines(definesSet, defines, "");
+ this->JoinDefines(debugDefinesSet, debugDefines, "");
+ this->JoinDefines(releaseDefinesSet, releaseDefines, "");
+ this->JoinDefines(minsizeDefinesSet, minsizeDefines, "");
+ this->JoinDefines(debugrelDefinesSet, debugrelDefines, "");
+
+ flags += defines;
+ flagsDebug += debugDefines;
+ flagsRelease += releaseDefines;
+ flagsMinSizeRel += minsizeDefines;
+ flagsRelWithDebInfo += debugrelDefines;
+
+ // 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
+ // variable names. The previous code sets up flags* variables to
+ // contain the correct C or CXX flags
+ cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_MINSIZEREL",
+ flagsMinSizeRel.c_str());
+ cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_DEBUG",
+ flagsDebug.c_str());
+ cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELWITHDEBINFO",
+ flagsRelWithDebInfo.c_str());
+ cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELEASE",
+ flagsRelease.c_str());
+ cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS", flags.c_str());
+
+ cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_MINSIZEREL",
+ minsizeDefines.c_str());
+ cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_DEBUG",
+ debugDefines.c_str());
+ cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELWITHDEBINFO",
+ debugrelDefines.c_str());
+ cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS_RELEASE",
+ releaseDefines.c_str());
+ cmSystemTools::ReplaceString(line, "COMPILE_DEFINITIONS",
+ defines.c_str());
+ }
fout << line.c_str() << std::endl;
}