summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2002-10-06 12:12:59 -0400
committerAndy Cedilnik <andy.cedilnik@kitware.com>2002-10-06 12:12:59 -0400
commit9ed93397fbe57a09e2a510b45331fa925a392bf8 (patch)
tree6e0960bd96eca344d168bd6c1444e968e24b73de
parent1ba0a050395fda65718da8e62a896ea788dec8e4 (diff)
downloadcmake-9ed93397fbe57a09e2a510b45331fa925a392bf8.tar.gz
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...
-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 de92dabb07..1bb7a5bd54 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 1eaeb84e4f..f9a681328f 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 1482f27e53..3f720ef512 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 0000000000..b42bbfd1c1
--- /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 0000000000..67c42a20c5
--- /dev/null
+++ b/Tests/COnly/foo.h
@@ -0,0 +1 @@
+extern const char* foo;