Просмотр исходного кода

If you specify header file as source, it should still use C compiler and not CXX. Also fix COnly test so that it make sure that this still works...

Andy Cedilnik 23 лет назад
Родитель
Сommit
9ed93397fb
5 измененных файлов с 10 добавлено и 2 удалено
  1. 2 1
      Source/cmTarget.cxx
  2. 1 1
      Tests/COnly/CMakeLists.txt
  3. 5 0
      Tests/COnly/conly.c
  4. 1 0
      Tests/COnly/foo.c
  5. 1 0
      Tests/COnly/foo.h

+ 2 - 1
Source/cmTarget.cxx

@@ -206,7 +206,8 @@ bool cmTarget::HasCxx() const
   for(std::vector<cmSourceFile*>::const_iterator i =  m_SourceFiles.begin();
       i != m_SourceFiles.end(); ++i)
     {
-    if((*i)->GetSourceExtension() != "c")
+    if((*i)->GetSourceExtension() != "c" &&
+       (*i)->GetSourceExtension() != "h")
       {
       return true;
       }

+ 1 - 1
Tests/COnly/CMakeLists.txt

@@ -1,3 +1,3 @@
 # a simple C only test case
 PROJECT (conly C)
-ADD_EXECUTABLE (conly conly.c)
+ADD_EXECUTABLE (conly conly.c foo.c foo.h)

+ 5 - 0
Tests/COnly/conly.c

@@ -1,4 +1,9 @@
+#include "foo.h"
+
+#include <stdio.h>
+
 int main ()
 {
+  printf("Foo: %s\n", foo);
   return 0;
 }

+ 1 - 0
Tests/COnly/foo.c

@@ -0,0 +1 @@
+const char* foo = "Foo";

+ 1 - 0
Tests/COnly/foo.h

@@ -0,0 +1 @@
+extern const char* foo;