summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmTarget.cxx3
-rw-r--r--Tests/COnly/CMakeLists.txt2
-rw-r--r--Tests/COnly/conly.c5
-rw-r--r--Tests/COnly/foo.c1
-rw-r--r--Tests/COnly/foo.h1
5 files changed, 10 insertions, 2 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index de92dab..1bb7a5b 100644
--- a/Source/cmTarget.cxx
+++ b/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;
}
diff --git a/Tests/COnly/CMakeLists.txt b/Tests/COnly/CMakeLists.txt
index 1eaeb84..f9a6813 100644
--- a/Tests/COnly/CMakeLists.txt
+++ b/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)
diff --git a/Tests/COnly/conly.c b/Tests/COnly/conly.c
index 1482f27..3f720ef 100644
--- a/Tests/COnly/conly.c
+++ b/Tests/COnly/conly.c
@@ -1,4 +1,9 @@
+#include "foo.h"
+
+#include <stdio.h>
+
int main ()
{
+ printf("Foo: %s\n", foo);
return 0;
}
diff --git a/Tests/COnly/foo.c b/Tests/COnly/foo.c
new file mode 100644
index 0000000..b42bbfd
--- /dev/null
+++ b/Tests/COnly/foo.c
@@ -0,0 +1 @@
+const char* foo = "Foo";
diff --git a/Tests/COnly/foo.h b/Tests/COnly/foo.h
new file mode 100644
index 0000000..67c42a20
--- /dev/null
+++ b/Tests/COnly/foo.h
@@ -0,0 +1 @@
+extern const char* foo;