diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2003-10-16 03:42:06 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2003-10-16 03:42:06 (GMT) |
commit | db3cd8259068f09c53dad3a2e81c1b78ba7683eb (patch) | |
tree | 388d23b26401cd9a4e9ff5e7740e72a4be9af02c /Source | |
parent | de27c1207b9d61c604b1e89803dd343498e84911 (diff) | |
download | CMake-db3cd8259068f09c53dad3a2e81c1b78ba7683eb.zip CMake-db3cd8259068f09c53dad3a2e81c1b78ba7683eb.tar.gz CMake-db3cd8259068f09c53dad3a2e81c1b78ba7683eb.tar.bz2 |
BUG: fix for bug 78 should be on 1.8 branch
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 124 |
1 files changed, 88 insertions, 36 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 6fdbe17..18be630 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -253,32 +253,26 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, << "\t\t\t\tName=\"VCCLCompilerTool\"\n" << "\t\t\t\tAdditionalOptions=\""; std::string flags; + std::string flagsRelease = " "; + std::string flagsMinSize = " "; + std::string flagsDebug = " "; + std::string flagsDebugRel = " "; if(target.HasCxx()) { flags = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS"); + flagsRelease += m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_RELEASE"); + flagsMinSize += m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_MINSIZEREL"); + flagsDebug += m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_DEBUG"); + flagsDebugRel += m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_RELWITHDEBINFO"); } else { - if(m_Makefile->GetDefinition("CMAKE_C_FLAGS")) - { - flags = m_Makefile->GetDefinition("CMAKE_C_FLAGS"); - } + flags = m_Makefile->GetDefinition("CMAKE_C_FLAGS"); + flagsRelease += m_Makefile->GetDefinition("CMAKE_C_FLAGS_RELEASE"); + flagsMinSize += m_Makefile->GetDefinition("CMAKE_C_FLAGS_MINSIZEREL"); + flagsDebug += m_Makefile->GetDefinition("CMAKE_C_FLAGS_DEBUG"); + flagsDebugRel += m_Makefile->GetDefinition("CMAKE_C_FLAGS_RELWITHDEBINFO"); } - cmSystemTools::ReplaceString(flags, "\"", """); - fout << flags; - - fout << " -DCMAKE_INTDIR=\\"" << configName << "\\"" - << "\"\n"; - - fout << "\t\t\t\tAdditionalIncludeDirectories=\""; - std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories(); - std::vector<std::string>::iterator i = includes.begin(); - for(;i != includes.end(); ++i) - { - std::string ipath = this->ConvertToXMLOutputPath(i->c_str()); - fout << ipath << ";"; - } - fout << "\"\n"; // Optimization = 0 None Debug /O0 // Optimization = 1 MinSize /O1 @@ -295,34 +289,92 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, // InlineFunctionExpansion = 2 any time you can + int runtime = 0; + int optimized = 0; + int inlineFunctions = 0; + const char* pre = "WIN32,_DEBUG,_WINDOWS"; + // set the flags and defaults for + // runtime, optimized, and inlineFunctions , and + // default pre processor flags if(strcmp(configName, "Debug") == 0) { - fout << "\t\t\t\tOptimization=\"0\"\n" - << "\t\t\t\tRuntimeLibrary=\"3\"\n" - << "\t\t\t\tInlineFunctionExpansion=\"0\"\n" - << "\t\t\t\tPreprocessorDefinitions=\"WIN32,_DEBUG,_WINDOWS"; + inlineFunctions = 0; + flags += flagsDebug; + optimized = 0; + runtime = 3; + pre = "WIN32,_DEBUG,_WINDOWS"; } - else if(strcmp(configName, "Release") == 0) + else if (strcmp(configName, "Release") == 0) { - fout << "\t\t\t\tOptimization=\"2\"\n" - << "\t\t\t\tRuntimeLibrary=\"2\"\n" - << "\t\t\t\tInlineFunctionExpansion=\"1\"\n" - << "\t\t\t\tPreprocessorDefinitions=\"WIN32,NDEBUG,_WINDOWS"; + inlineFunctions = 1; + optimized =2; + pre = "WIN32,NDEBUG,_WINDOWS"; + flags += flagsRelease; + runtime = 2; } else if(strcmp(configName, "MinSizeRel") == 0) { - fout << "\t\t\t\tOptimization=\"1\"\n" - << "\t\t\t\tRuntimeLibrary=\"2\"\n" - << "\t\t\t\tInlineFunctionExpansion=\"1\"\n" - << "\t\t\t\tPreprocessorDefinitions=\"WIN32,NDEBUG,_WINDOWS"; + inlineFunctions = 1; + runtime = 2; + optimized = 1; + pre = "WIN32,NDEBUG,_WINDOWS"; + flags += flagsMinSize; } else if(strcmp(configName, "RelWithDebInfo") == 0) { - fout << "\t\t\t\tOptimization=\"2\"\n" - << "\t\t\t\tRuntimeLibrary=\"2\"\n" - << "\t\t\t\tInlineFunctionExpansion=\"1\"\n" - << "\t\t\t\tPreprocessorDefinitions=\"WIN32,NDEBUG,_WINDOWS"; + inlineFunctions = 1; + optimized = 2; + runtime = 2; + pre = "WIN32,NDEBUG,_WINDOWS"; + flags += flagsDebugRel; + } + + cmSystemTools::ReplaceString(flags, "\"", """); + fout << flags; + + fout << " -DCMAKE_INTDIR=\\"" << configName << "\\"" + << "\"\n"; + + fout << "\t\t\t\tAdditionalIncludeDirectories=\""; + std::vector<std::string>& includes = m_Makefile->GetIncludeDirectories(); + std::vector<std::string>::iterator i = includes.begin(); + for(;i != includes.end(); ++i) + { + std::string ipath = this->ConvertToXMLOutputPath(i->c_str()); + fout << ipath << ";"; + } + fout << "\"\n"; + // check the flags for the run time library flag options + // if there is a match set the run time flag + if(flags.find("MTd") != flags.npos) + { + runtime = 1; } + else if (flags.find("MDd") != flags.npos) + { + runtime = 3; + } + else if (flags.find("MLd") != flags.npos) + { + runtime = 5; + } + else if (flags.find("MT") != flags.npos) + { + runtime = 0; + } + else if (flags.find("MD") != flags.npos) + { + runtime = 2; + } + else if (flags.find("ML") != flags.npos) + { + runtime = 4; + } + + fout << "\t\t\t\tOptimization=\"" << optimized << "\"\n" + << "\t\t\t\tRuntimeLibrary=\"" << runtime << "\"\n" + << "\t\t\t\tInlineFunctionExpansion=\"" << inlineFunctions << "\"\n" + << "\t\t\t\tPreprocessorDefinitions=\"" << pre; if(target.GetType() == cmTarget::SHARED_LIBRARY || target.GetType() == cmTarget::MODULE_LIBRARY) { |