diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2003-01-13 14:30:48 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2003-01-13 14:30:48 (GMT) |
commit | b9d5389bcaa89fa285551547bb177dada83ca284 (patch) | |
tree | 873a831586070f78f4df8fd90e4279f34a5050cf | |
parent | c6323d154ba79fcbb14f5d4e1ba5852e8b82d1c8 (diff) | |
download | CMake-b9d5389bcaa89fa285551547bb177dada83ca284.zip CMake-b9d5389bcaa89fa285551547bb177dada83ca284.tar.gz CMake-b9d5389bcaa89fa285551547bb177dada83ca284.tar.bz2 |
BUG: fix CMAKE_C_FLAGS for visual studio 6, and add a test case
-rw-r--r-- | Source/cmLocalVisualStudio6Generator.cxx | 67 | ||||
-rw-r--r-- | Tests/Complex/Library/testConly.c | 2 | ||||
-rw-r--r-- | Tests/ComplexOneConfig/Library/testConly.c | 2 | ||||
-rw-r--r-- | Tests/ComplexRelativePaths/Library/testConly.c | 2 |
4 files changed, 39 insertions, 34 deletions
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index e6c75c0..894c89e 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -842,41 +842,52 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha "EXTRA_DEFINES", m_Makefile->GetDefineFlags()); cmGlobalGenerator* gen = this->GetGlobalGenerator(); - if ( gen->GetLanguageEnabled("C") ||gen->GetLanguageEnabled("CXX") ) + // stroe flags for each configuration + std::string flags = " "; + std::string flagsRelease = " "; + std::string flagsMinSize = " "; + std::string flagsDebug = " "; + std::string flagsDebugRel = " "; + // if CXX is on and the target contains cxx code then add the cxx flags + if ( gen->GetLanguageEnabled("CXX") && target.HasCxx() ) { - std::string flags = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_RELEASE"); - flags += " -DCMAKE_INTDIR=\\\"Release\\\""; - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELEASE", flags.c_str()); - flags = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_MINSIZEREL"); - flags += " -DCMAKE_INTDIR=\\\"MinSizeRel\\\""; - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_MINSIZEREL", flags.c_str()); - flags = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_DEBUG"); - flags += " -DCMAKE_INTDIR=\\\"Debug\\\""; - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_DEBUG", flags.c_str()); - flags = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_RELWITHDEBINFO"); - flags += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\""; - cmSystemTools::ReplaceString(line,"CMAKE_CXX_FLAGS_RELWITHDEBINFO", flags.c_str()); - flags = ""; - if ( m_Makefile->GetDefinition("CMAKE_C_FLAGS") ) - { - flags += m_Makefile->GetDefinition("CMAKE_C_FLAGS"); - } - if ( m_Makefile->GetDefinition("CMAKE_CXX_FLAGS") ) - { - if ( flags.size() > 0 ) - { - flags += " "; - } - flags += m_Makefile->GetDefinition("CMAKE_CXX_FLAGS"); - } - - cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS", flags.c_str()); + flagsRelease = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_RELEASE"); + flagsRelease += " -DCMAKE_INTDIR=\\\"Release\\\" "; + flagsMinSize = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_MINSIZEREL"); + flagsMinSize += " -DCMAKE_INTDIR=\\\"MinSizeRel\\\" "; + flagsDebug = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_DEBUG"); + flagsDebug += " -DCMAKE_INTDIR=\\\"Debug\\\" "; + flagsDebugRel = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_RELWITHDEBINFO"); + flagsDebugRel += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\" "; + flags = " "; + flags = m_Makefile->GetDefinition("CMAKE_CXX_FLAGS"); + flags += " "; } + // if C and the target is not CXX + else if(gen->GetLanguageEnabled("C") && !target.HasCxx()) + { + flagsRelease += m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_RELEASE"); + flagsRelease += " -DCMAKE_INTDIR=\\\"Release\\\""; + flagsMinSize += m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_MINSIZEREL"); + flagsMinSize += " -DCMAKE_INTDIR=\\\"MinSizeRel\\\""; + flagsDebug += m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_DEBUG"); + flagsDebug += " -DCMAKE_INTDIR=\\\"Debug\\\""; + flagsDebugRel += m_Makefile->GetDefinition("CMAKE_CXX_FLAGS_RELWITHDEBINFO"); + flagsDebugRel += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\""; + flags = " "; + flags = m_Makefile->GetDefinition("CMAKE_C_FLAGS"); + } + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_RELEASE", flagsRelease.c_str()); + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_MINSIZEREL", flagsMinSize.c_str()); + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS_DEBUG", flagsDebug.c_str()); + cmSystemTools::ReplaceString(line,"CMAKE_CXX_FLAGS_RELWITHDEBINFO", flagsDebugRel.c_str()); + cmSystemTools::ReplaceString(line, "CMAKE_CXX_FLAGS", flags.c_str()); fout << line.c_str() << std::endl; } } + void cmLocalVisualStudio6Generator::WriteDSPFooter(std::ostream& fout) { std::ifstream fin(m_DSPFooterTemplate.c_str()); diff --git a/Tests/Complex/Library/testConly.c b/Tests/Complex/Library/testConly.c index d179b21..35d6a39 100644 --- a/Tests/Complex/Library/testConly.c +++ b/Tests/Complex/Library/testConly.c @@ -2,13 +2,11 @@ int CsharedFunction() { -#if !defined(_WIN32) || defined(__CYGWIN__) #ifndef TEST_C_FLAGS printf("TEST_C_FLAGS failed\n"); return 0; #else printf("Passed: TEST_C_FLAGS passed\n"); #endif -#endif return 1; } diff --git a/Tests/ComplexOneConfig/Library/testConly.c b/Tests/ComplexOneConfig/Library/testConly.c index d179b21..35d6a39 100644 --- a/Tests/ComplexOneConfig/Library/testConly.c +++ b/Tests/ComplexOneConfig/Library/testConly.c @@ -2,13 +2,11 @@ int CsharedFunction() { -#if !defined(_WIN32) || defined(__CYGWIN__) #ifndef TEST_C_FLAGS printf("TEST_C_FLAGS failed\n"); return 0; #else printf("Passed: TEST_C_FLAGS passed\n"); #endif -#endif return 1; } diff --git a/Tests/ComplexRelativePaths/Library/testConly.c b/Tests/ComplexRelativePaths/Library/testConly.c index d179b21..35d6a39 100644 --- a/Tests/ComplexRelativePaths/Library/testConly.c +++ b/Tests/ComplexRelativePaths/Library/testConly.c @@ -2,13 +2,11 @@ int CsharedFunction() { -#if !defined(_WIN32) || defined(__CYGWIN__) #ifndef TEST_C_FLAGS printf("TEST_C_FLAGS failed\n"); return 0; #else printf("Passed: TEST_C_FLAGS passed\n"); #endif -#endif return 1; } |