From 9ed93397fbe57a09e2a510b45331fa925a392bf8 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Sun, 6 Oct 2002 12:12:59 -0400 Subject: 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... --- Source/cmTarget.cxx | 3 ++- Tests/COnly/CMakeLists.txt | 2 +- Tests/COnly/conly.c | 5 +++++ Tests/COnly/foo.c | 1 + Tests/COnly/foo.h | 1 + 5 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 Tests/COnly/foo.c create mode 100644 Tests/COnly/foo.h 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::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 + 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; -- cgit v0.12