diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2006-05-04 17:35:56 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2006-05-04 17:35:56 (GMT) |
commit | 1794836ee3e8727c9eed233f1ebaa0a1dbf76e57 (patch) | |
tree | df0389118914d2d560c58933e8729a06a428b89a /Source | |
parent | 8268d16bbb8275564f6650317665600a94c2b716 (diff) | |
download | CMake-1794836ee3e8727c9eed233f1ebaa0a1dbf76e57.zip CMake-1794836ee3e8727c9eed233f1ebaa0a1dbf76e57.tar.gz CMake-1794836ee3e8727c9eed233f1ebaa0a1dbf76e57.tar.bz2 |
ENH: fix build c stuff with c and c++ with c++
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 4143481..fdc4288 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -262,6 +262,8 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[] = {"EnableEnhancedInstructionSet", "arch:SSE", "Use sse instructions", "1"}, {"FavorSizeOrSpeed", "Ot", "Favor fast code", "1"}, {"FavorSizeOrSpeed", "Os", "Favor small code", "2"}, + {"CompileAs", "TC", "Compile as c code", "1"}, + {"CompileAs", "TP", "Compile as c++ code", "2"}, {"Optimization", "Od", "Non Debug", "0"}, {"Optimization", "O1", "Min Size", "1"}, {"Optimization", "O2", "Max Speed", "2"}, @@ -395,6 +397,16 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, flags += " "; flags += this->Makefile->GetRequiredDefinition(flagVar.c_str()); } + // set the correct language + if(strcmp(linkLanguage, "C") == 0) + { + flags += " /TC "; + } + if(strcmp(linkLanguage, "CXX") == 0) + { + flags += " /TP "; + } + std::cerr << flags << "\n"; } // Add the target-specific flags. @@ -1035,10 +1047,21 @@ void cmLocalVisualStudio7Generator::WriteGroup(const cmSourceGroup *sg, cmTarget } const char* lang = this->GlobalGenerator->GetLanguageFromExtension((*sf)->GetSourceExtension().c_str()); - if(lang && strcmp(lang, "CXX") == 0) + const char* linkLanguage = target.GetLinkerLanguage(this->GetGlobalGenerator()); + // if the source file does not match the linker language + // then force c or c++ + if(linkLanguage && lang && strcmp(lang, linkLanguage) != 0) { - // force a C++ file type - compileFlags += " /TP "; + if(strcmp(lang, "CXX") == 0) + { + // force a C++ file type + compileFlags += " /TP "; + } + else if(strcmp(lang, "C") == 0) + { + // force to c + compileFlags += " /TC "; + } } // Check for extra object-file dependencies. const char* deps = (*sf)->GetProperty("OBJECT_DEPENDS"); |