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::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 + 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;