diff options
author | Stephen Kelly <steveire@gmail.com> | 2012-08-09 07:44:15 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2012-08-20 20:30:11 (GMT) |
commit | 3dae652b4ea8e039dd9f4d845497ec988fbbe82c (patch) | |
tree | 22241a616f674ac6fe82375690e8485d19e32725 /Source/cmLocalVisualStudio6Generator.cxx | |
parent | d46f8afae98cd8f50cff9915a5a9dc680b9e0518 (diff) | |
download | CMake-3dae652b4ea8e039dd9f4d845497ec988fbbe82c.zip CMake-3dae652b4ea8e039dd9f4d845497ec988fbbe82c.tar.gz CMake-3dae652b4ea8e039dd9f4d845497ec988fbbe82c.tar.bz2 |
Don't duplicate -D defines sent to the compiler.
There is no need to do so. Be consistent with include directories and
ensure uniqueness.
This requires changing the API of the cmLocalGenerator::AppendDefines
method, and changing the generators to match.
The test unfortunately can't test for uniqueness, but it at least verifies
that nothing gets lost.
Diffstat (limited to 'Source/cmLocalVisualStudio6Generator.cxx')
-rw-r--r-- | Source/cmLocalVisualStudio6Generator.cxx | 92 |
1 files changed, 61 insertions, 31 deletions
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 1a7e611..9f2a863 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -418,25 +418,42 @@ void cmLocalVisualStudio6Generator // Add per-source and per-configuration preprocessor definitions. std::map<cmStdString, cmStdString> cdmap; - this->AppendDefines(compileFlags, - (*sf)->GetProperty("COMPILE_DEFINITIONS"), lang); + + { + std::set<std::string> targetCompileDefinitions; + + this->AppendDefines(targetCompileDefinitions, + (*sf)->GetProperty("COMPILE_DEFINITIONS")); + this->JoinDefines(targetCompileDefinitions, compileFlags, lang); + } + if(const char* cdefs = (*sf)->GetProperty("COMPILE_DEFINITIONS_DEBUG")) { - this->AppendDefines(cdmap["DEBUG"], cdefs, lang); + std::set<std::string> debugCompileDefinitions; + this->AppendDefines(debugCompileDefinitions, cdefs); + this->JoinDefines(debugCompileDefinitions, cdmap["DEBUG"], lang); } if(const char* cdefs = (*sf)->GetProperty("COMPILE_DEFINITIONS_RELEASE")) { - this->AppendDefines(cdmap["RELEASE"], cdefs, lang); + std::set<std::string> releaseCompileDefinitions; + this->AppendDefines(releaseCompileDefinitions, cdefs); + this->JoinDefines(releaseCompileDefinitions, cdmap["RELEASE"], lang); } if(const char* cdefs = (*sf)->GetProperty("COMPILE_DEFINITIONS_MINSIZEREL")) { - this->AppendDefines(cdmap["MINSIZEREL"], cdefs, lang); + std::set<std::string> minsizerelCompileDefinitions; + this->AppendDefines(minsizerelCompileDefinitions, cdefs); + this->JoinDefines(minsizerelCompileDefinitions, cdmap["MINSIZEREL"], + lang); } if(const char* cdefs = (*sf)->GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO")) { - this->AppendDefines(cdmap["RELWITHDEBINFO"], cdefs, lang); + std::set<std::string> relwithdebinfoCompileDefinitions; + this->AppendDefines(relwithdebinfoCompileDefinitions, cdefs); + this->JoinDefines(relwithdebinfoCompileDefinitions, + cdmap["RELWITHDEBINFO"], lang); } bool excludedFromBuild = @@ -1653,43 +1670,56 @@ void cmLocalVisualStudio6Generator } // Add per-target and per-configuration preprocessor definitions. - std::string defines = " "; - std::string debugDefines = " "; - std::string releaseDefines = " "; - std::string minsizeDefines = " "; - std::string debugrelDefines = " "; + 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->AppendDefines( - defines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS"), 0); + definesSet, + this->Makefile->GetProperty("COMPILE_DEFINITIONS")); this->AppendDefines( - debugDefines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_DEBUG"),0); + debugDefinesSet, + this->Makefile->GetProperty("COMPILE_DEFINITIONS_DEBUG")); this->AppendDefines( - releaseDefines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELEASE"), 0); + releaseDefinesSet, + this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELEASE")); this->AppendDefines( - minsizeDefines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"), 0); + minsizeDefinesSet, + this->Makefile->GetProperty("COMPILE_DEFINITIONS_MINSIZEREL")); this->AppendDefines( - debugrelDefines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"), 0); + debugrelDefinesSet, + this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO")); this->AppendDefines( - defines, - target.GetProperty("COMPILE_DEFINITIONS"), 0); + definesSet, + target.GetProperty("COMPILE_DEFINITIONS")); this->AppendDefines( - debugDefines, - target.GetProperty("COMPILE_DEFINITIONS_DEBUG"), 0); + debugDefinesSet, + target.GetProperty("COMPILE_DEFINITIONS_DEBUG")); this->AppendDefines( - releaseDefines, - target.GetProperty("COMPILE_DEFINITIONS_RELEASE"), 0); + releaseDefinesSet, + target.GetProperty("COMPILE_DEFINITIONS_RELEASE")); this->AppendDefines( - minsizeDefines, - target.GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"), 0); + minsizeDefinesSet, + target.GetProperty("COMPILE_DEFINITIONS_MINSIZEREL")); this->AppendDefines( - debugrelDefines, - target.GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"), 0); + debugrelDefinesSet, + target.GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO")); + + std::string defines = " "; + std::string debugDefines = " "; + std::string releaseDefines = " "; + std::string minsizeDefines = " "; + std::string debugrelDefines = " "; + + this->JoinDefines(definesSet, defines, 0); + this->JoinDefines(debugDefinesSet, debugDefines, 0); + this->JoinDefines(releaseDefinesSet, releaseDefines, 0); + this->JoinDefines(minsizeDefinesSet, minsizeDefines, 0); + this->JoinDefines(debugrelDefinesSet, debugrelDefines, 0); + flags += defines; flagsDebug += debugDefines; flagsRelease += releaseDefines; |