[cmake-commits] hoffman committed CMakeLists.txt 1.333 1.334 cmLocalVisualStudio6Generator.cxx 1.112 1.113 cmLocalVisualStudio7Generator.cxx 1.171 1.172

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Feb 20 09:35:23 EST 2007


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv12903/Source

Modified Files:
	CMakeLists.txt cmLocalVisualStudio6Generator.cxx 
	cmLocalVisualStudio7Generator.cxx 
Log Message:
BUG: fix for bug 4423 set language fixes


Index: cmLocalVisualStudio7Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.cxx,v
retrieving revision 1.171
retrieving revision 1.172
diff -u -d -r1.171 -r1.172
--- cmLocalVisualStudio7Generator.cxx	17 Feb 2007 13:46:23 -0000	1.171
+++ cmLocalVisualStudio7Generator.cxx	20 Feb 2007 14:35:21 -0000	1.172
@@ -1148,9 +1148,16 @@
       }
     const char* lang = this->GlobalGenerator->GetLanguageFromExtension
       ((*sf)->GetSourceExtension().c_str());
+    const char* sourceLang = this->GetSourceFileLanguage(*(*sf));
     const char* linkLanguage = target.GetLinkerLanguage
       (this->GetGlobalGenerator());
-
+    bool needForceLang = false;
+    // source file does not match its extension language
+    if(lang && sourceLang && strcmp(lang, sourceLang) != 0)
+      {
+      needForceLang = true;
+      lang = sourceLang;
+      }
     // If lang is set, the compiler will generate code automatically.
     // If HEADER_FILE_ONLY is set, we must suppress this generation in
     // the project file
@@ -1159,7 +1166,7 @@
 
     // if the source file does not match the linker language
     // then force c or c++
-    if(linkLanguage && lang && strcmp(lang, linkLanguage) != 0)
+    if(needForceLang || (linkLanguage && lang && strcmp(lang, linkLanguage) != 0))
       {
       if(strcmp(lang, "CXX") == 0)
         {

Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CMakeLists.txt,v
retrieving revision 1.333
retrieving revision 1.334
diff -u -d -r1.333 -r1.334
--- CMakeLists.txt	19 Feb 2007 21:34:05 -0000	1.333
+++ CMakeLists.txt	20 Feb 2007 14:35:21 -0000	1.334
@@ -697,6 +697,16 @@
       -DCMAKE_TEST_SYSTEM_LIBRARIES:BOOL=${CMAKE_TEST_SYSTEM_LIBRARIES}
       --test-command complex)
 
+    ADD_TEST(SetLang ${CMAKE_CTEST_COMMAND}
+      --build-and-test
+      "${CMake_SOURCE_DIR}/Tests/SetLang"
+      "${CMake_BINARY_DIR}/Tests/SetLang"
+      --build-two-config
+      --build-generator ${CMAKE_TEST_GENERATOR}
+      --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+      --build-project SetLang
+      --test-command bar)
+
 #     ADD_TEST(ConvLibrary ${CMAKE_CTEST_COMMAND}
 #       --build-and-test
 #       "${CMake_SOURCE_DIR}/Tests/ConvLibrary"
@@ -707,6 +717,7 @@
 #       --build-project ConvLibrary
 #       --test-command bartest)
 
+
 #    ADD_TEST(complexRelativePaths  ${CMAKE_CTEST_COMMAND}
 #      --build-and-test
 #      "${CMake_SOURCE_DIR}/Tests/ComplexRelativePaths"

Index: cmLocalVisualStudio6Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio6Generator.cxx,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -d -r1.112 -r1.113
--- cmLocalVisualStudio6Generator.cxx	18 Feb 2007 14:31:16 -0000	1.112
+++ cmLocalVisualStudio6Generator.cxx	20 Feb 2007 14:35:21 -0000	1.113
@@ -421,12 +421,16 @@
       compileFlags += cflags;
       }
 
-    const char* lang = this->GlobalGenerator->
-      GetLanguageFromExtension((*sf)->GetSourceExtension().c_str());
+    const char* lang = this->GetSourceFileLanguage(*(*sf));
     if(lang && strcmp(lang, "CXX") == 0)
       {
       // force a C++ file type
       compileFlags += " /TP ";
+      } 
+    else if(strcmp(lang, "C") == 0)
+      {
+      // force to c file type
+      compileFlags += " /TC ";
       }
       
     // Check for extra object-file dependencies.



More information about the Cmake-commits mailing list